Using imbedded commands inside expr(1)

news at usenet.ins.cwru.edu news at usenet.ins.cwru.edu
Sat Nov 10 01:54:33 AEST 1990


In article <1462 at eastman.UUCP> gerwitz at kodak.com (Paul Gerwitz) writes:
>I seem to be having trouble using expr.  The following dies:
>
>    test=`expr `tail +3 file` + 1` 

Since you're using ksh, how about:

	test=$(expr $(tail +3 file) + 1)

If you want backwards compatibility with sh, use this:

	test=`expr \`tail +3 file\` + 1`

Chet
-- 
Chet Ramey
Network Services Group			``I die, Horatio''
Case Western Reserve University
chet at ins.CWRU.Edu



More information about the Comp.unix.shell mailing list