librenms/librenms

View on GitHub
scripts/Migration/XML_Conversion/mkdir.sh

Summary

Maintainability
Test Coverage

read without -r will mangle backslashes.
Open

while read line 

read without -r mangle backslashes

Problematic code:

echo "Enter name:"
read name

Correct code:

echo "Enter name:"
read -r name

Rationale:

By default, read will interpret backslashes before spaces and line feeds, and otherwise strip them. This is rarely expected or desired.

Normally you just want to read data, which is what read -r does. You should always use -r unless you have a good reason not to.

Note that read -r will still strip leading and trailing spaces. IFS="" read -r prevents this.

Exceptions:

If you want backslashes to affect field splitting and line terminators instead of being read, you can disable this message with a [[directive]].

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

There are no issues that match your filters.

Category
Status