Bourne shell programming question...

Andrew V Royappa avr at CS-Arthur
Tue May 15 19:34:55 AEST 1984


x <-- 'x'

	to read a line off a file:
-----
	a=`head -1 $file`
-----
If $file is null, stdin will be read. For shared code, you could do
-----
	CODE="lines of code separated by ; "

	eval $CODE		# use code
-----
If you do complicated things with quotes, you'll probably have to
backslash a lot (backslash ? backstab ?).

Another way to do this is to put all commands in a file (in 
/tmp/code.$$ or such), do eval `cat <file>`, and remove the
file later.

				Andrew Royappa
				{ucbvax,decvax,ihnp4,pur-ee}!purdue!avr

yep, I should use 'r', but something weird happened when I did.



More information about the Comp.unix mailing list