Using imbedded commands inside expr(1)

Paul Chamberlain tif at doorstop.austin.ibm.com
Sat Nov 10 03:44:34 AEST 1990


In article <1462 at eastman.UUCP> gerwitz at kodak.com (Paul Gerwitz) writes:
>    test=`expr `tail +3 file` + 1` 

This works on my /bin/sh and my /bin/ksh:
	echo `expr \`expr 5 + 1\` + 3`
In fact so does this:
	echo `expr \`expr \\\`expr 2 + 3\\\` + 1\` + 3`

I didn't try it with tail or assigning it to a variable but it better
work just as well (I'm assuming that you have a 3 line file, personally
I'd use "tail -1" instead).

Anybody know why the same thing fails on csh?

Paul Chamberlain | I do NOT represent IBM.     tif at doorstop, sc30661 at ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmchs!auschs!doorstop.austin.ibm.com!tif



More information about the Comp.unix.shell mailing list