[ale] bash question

Wandered Inn esoteric at denali.atlnet.com
Sat Jun 12 23:07:42 EDT 1999


Michelangelo Grigni wrote:

> This is a job for the shell IFS variable.  Just set it to
> contain a single newline, and then each line will be
> treated as a single input field.   Like this:
> 
> IFS='
> '
> for f in `cat t1.txt` ; do echo $f ; done
> 
> Or like this, without cat:
> 
> IFS='
> '
> while read f; do echo $f; done < t1.txt
> 
> You may need to restore IFS to its default, depending on
> what else you do in the script.

With the 'while read f;' solution above, you do not need to modify IFS,
since 'read f' will populate the var 'f' with one line at a time.

--
Until later: Geoffrey		esoteric at denali.atlnet.com

It should be illegal to yell "Y2K" in a crowded economy.
	-- Larry Wall, creator of the programming language Perl






More information about the Ale mailing list