bourne shell query

James Brister brister at decwrl.dec.com
Fri Aug 31 02:59:33 AEST 1990


On 30 Aug 90 00:56:38 GMT,
fred at maccs.dcss.mcmaster.ca (Fred Whiteside) said:

> #!/bin/sh
> cd /usr/spool/news/comp/std/c
> zots=$1
> echo "Should ignore files with name < $zots"
> files=`ls -rt * |grep -v '.*[a-zA-Z].*' | awk $1 '>=' $zots {print}`
> echo $files

I changed the next to last line to this:
files=`ls -rt * |grep -v '.*[a-zA-Z].*' | awk '$1 >= '$zots' {print}'`


Awk expects its program to be one argument. You've given it four. You DON'T
want the $1 to be expanded, but you DO want the $zots to be expanded, hence
the funny quoting.

James
--
James Brister                                           brister at decwrl.dec.com
DEC Western Software Lab., Palo Alto, California.         .....!decwrl!brister



More information about the Comp.unix.shell mailing list