🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1723

Re: Using imbedded commands inside expr(1)

#1723
From: William R. Pringle
Date: Thu, 08 Nov 1990 04:56
15 lines
894 bytes
In article <1462@eastman.UUCP> gerwitz@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
Technical Details
Message-ID: <15525@burdvax.PRC.Unisys.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!rutgers!gatech!udel!burdvax!wrp
References: <1462@eastman.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!rutgers!gatech!udel!burdvax!wrp
From: wrp@PRC.Unisys.COM (William R. Pringle)
Newsgroups: comp.unix.shell
Subject: Re: Using imbedded commands inside expr(1)
Summary: Quote with backslashes
Message-ID: <15525@burdvax.PRC.Unisys.COM>
Date: 8 Nov 90 04:56:33 GMT
References: <1462@eastman.UUCP>
Organization: Unisys Corporation, Paoli Research Center; Paoli, PA
Lines: 15