Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!paladin.american.edu!howland.reston.ans.net!usenet.ins.cwru.edu!cleveland.Freenet.Edu!bx970 From: bx970@cleveland.Freenet.Edu (Donna A. Lilly) Newsgroups: comp.unix.bsd Subject: Re: command output substitution in sh script Date: 30 Nov 1993 23:42:58 GMT Organization: Case Western Reserve University, Cleveland, OH (USA) Lines: 23 Message-ID: <2dglq2$kau@usenet.INS.CWRU.Edu> References: <2dgje8$grv@usenet.INS.CWRU.Edu> Reply-To: bx970@po.cwru.edu (Donna Lilly) NNTP-Posting-Host: nextsun.ins.cwru.edu In a previous article, bx970@cleveland.Freenet.Edu (Donna A. Lilly) says: >Earlier I asked about testing if a file exists csh scripts and I was >convinced to use sh for programming. One problem I have is with >substitution of a commands output and testing the resulting value in the sh >syntax. E.g. > >I want to process files that start with someprefix a period followed by two >digits (just for an example). I couldn't get this to work in the sh syntax. > >in csh: > >if (`cat $file | egrep 'someprefix\.[0-9][0-9]$' | wc -c` > 13) then ^^^ Oops! I meant to say `echo $file ... not cat (I wanted to test the filename not file contents). Anyhow, anyone know how this is done in sh scripts? Thanks a lot for any help, -- Donna Lilly Cleveland, OH