'c' shell scripts

Greg Woods woods at hao.UUCP
Fri Dec 16 01:00:06 AEST 1983


The construct

set x=`cat file`

works quite well. In fact, the shell will parse newlines just like blanks.
So if your file contains a list of other files, that looks like

file1
file2
....

then $x expands to "file1 file2 ....". More usually, I use something like

foreach f (`cat file`)
....
end

It should be pointed out that this does have limitations. It works fine
as long as the file in question isn't too long. Otherwise you get an
"Out of memory" diagnostic.

	     Greg "C-shell hacker" Woods
-- 
{ucbvax!hplabs | allegra!nbires | decvax!kpno | harpo!seismo | ihnp4!kpno}
       		        !hao!woods



More information about the Comp.unix mailing list