On Tue, Dec 17, 2013 at 03:18:31PM +0200, Sergey Skripnick wrote: > Description: > When executed script (by `source' or by dot syntax) which have 0d0a > characters as a newlines, readed variables have incorrect values. As you > can see below, 0d character is included,
This is expected. > but there is no 0d character > between the quotes. > VAR1="ok" # unused > VAR="ok" > VAR3="ok" # unused The value on the right hand side of the = in an assignment does not need to be contained within quotes. The 0x0d character that follows the quotes becomes part of the value, just as if you had written VAR="foo"bar As far as Bash is concerned, 0x0d is just a normal character, like x or 7. > echo $VAR | hexdump -C Failure to quote the expansion "$VAR" may lead to confusion in the future. 0x0d is not part of IFS, so in this particular case there was no problem, but it will eventually bite you if you continue to neglect it. echo "$VAR" | hexdump -C Even better would be to use printf %s, so that an extra newline is not added by echo. printf %s "$VAR" | hexdump -C Or, Bash-specific: declare -p VAR