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, but there is no 0d character
between the quotes.
Repeat-By:
Here the script for reproduce (dos2unix required)
---------------------------------------
cat > data<<EOF
VAR1="ok" # unused
VAR="ok"
VAR3="ok" # unused
EOF
cp data data-unix
mv data data-dos
unix2dos data-dos
. data-dos
echo $VAR | hexdump -C
[ $VAR = "ok" ] && echo "eq" || echo "ne"
. data-unix
echo $VAR | hexdump -C
[ $VAR = "ok" ] && echo "eq" || echo "ne"
---------------------------------------
The output is:
unix2dos: converting file data-dos to DOS format ...
00000000 6f 6b 0d 0a |ok..|
00000004
ne
00000000 6f 6b 0a |ok.|
00000003
eq