🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1740

Re: Using imbedded commands inside expr(1)

#1740
From: news
Date: Fri, 09 Nov 1990 14:54
19 lines
971 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` 

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@ins.CWRU.Edu
Technical Details
Message-ID: <1990Nov9.145433.4677@usenet.ins.cwru.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ncar!husc6!ukma!usenet.ins.cwru.edu!news
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!elroy.jpl.nasa.gov!ncar!husc6!ukma!usenet.ins.cwru.edu!news
From: news@usenet.ins.cwru.edu
Newsgroups: comp.unix.shell
Subject: Re: Using imbedded commands inside expr(1)
Message-ID: <1990Nov9.145433.4677@usenet.ins.cwru.edu>
Date: 9 Nov 90 14:54:33 GMT
References: <1462@eastman.UUCP>
Reply-To: chet@po.CWRU.Edu
Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA)
Lines: 20
Nntp-Posting-Host: thor.ins.cwru.edu