> ...
> $ IFS=""
> $ f() { echo $1; }; x="a b c"; f $x
> a b c
> 
> But, IFS influences `read`, which of course benefits from word
> splitting. In light of that conflict, I propose two possible
> solutions:
> 
> 1: shopt -s unsplit_vars
> 
> which will turn off word splitting for var expansion.
> 
> or 2: new IFS2 var that will override IFS for `read` (i.e. `read` will
> use IFS2 when IFS is unset).
> 

Could also do:

  IFS=$'\n\t' 

  echo "Checking..."; echo -n "$IFS"|hexdump

The IFS on the read could be considered script documentation for
the contents of the current file. Similar to awk's FS.

  while IFS=: read -re line; do : ; done  < file

Interesting read here, but pertains to splitting and filenames:
http://www.dwheeler.com/essays/filenames-in-shell.html
But could perhaps provide a supportive argument, maybe, for your suggestion
option #1. http://mywiki.wooledge.org/Quotes is helpful.

Peggy Russell



Reply via email to