On Wed, Feb 18, 2009 at 3:06 PM, Corey Edwards <[email protected]> wrote:
> Or rather, the IFS setting was interfering with bash showing you the
> contents of IFS.
>
>        [cedwa...@pheasant ~]$ echo foo${IFS}bar
>        foo bar
>        [cedwa...@pheasant ~]$ echo "foo${IFS}bar"
>        foo,bar

Wow, that hadn't occurred to me at all.  Even more nakedly:

  bash$ IFS=,
  bash$ echo $IFS

  bash$ echo "$IFS"
  ,

So IFS interferes with its own printing because during
field-splitting, bash filters IFS itself from input commands before
processing those commands.  Double-quoting suppresses the
field-splitting behavior, which makes the variable's value visible in
the echo command.  Very interesting.

Chris

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to