Manolis Kiagias wrote:

Do a little experiment (inspired from the post stated above):
#export IFS="\n"
#printf '<%s>\n' "$IFS" | cat -vt
will give <\n> ==> not what you expect
#export IFS='\n'
#printf '<%s>\n' "$IFS" | cat -vt
will give <\n> ==> again, not what you expect
#export IFS=$'\n'
#printf '<%s>\n' "$IFS" | cat -vt
will give

definitely a new line character (finally...)
I am not certain of the explanation, but from the above it seems to me
the IFS does not evaluate special '\something' characters unless there
is a $ in front. That is, of course, what you would do to get the value
of a shell variable. It seems then these characters need to be evaluated
in the same way.

Yup, that's what I too figured from my experiments. Strange.

Oh well ... good to know now that '\n' (even in double quotes etc) need not always refer to the newline. Sometimes the $ magic is required ... :-)

_______________________________________________ mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to