I've noticed that to print the value of the $IFS
variable in the shell I have to do something like:
$ printf '%s\nYour IFS is: %q' 'Hello' "$IFS"
Hello
Your IFS is: $' \t\n'
My question is why do I need to pass the IFS
in that special way? For example, why (or why wouldn't) it be possible to do:
$ echo $IFS
-- some parameter that prints special characters?$ printf "$IFS"
or$ printf '$IFS'
-- why wouldn't either of these work?- Why
$ printf "%q" $IFS
and$ printf "%q" '$IFS'
don't show this properly but$ printf "%q" "$IFS"
does?