Using imbedded commands inside expr(1)

William R. Pringle wrp at PRC.Unisys.COM
Thu Nov 8 15:56: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` 
>
>    Basically get a numeric value from a file and increment it, putting the
>    result in a shell variable.

The backslash can be used to quote nested backward quotes (and other
strange characters):

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


Bill Pringle



More information about the Comp.unix.shell mailing list