Fw: Problem with periodically done scripts

Malcolm Kay malcolm.kay at internode.on.net
Fri Jul 25 21:31:55 PDT 2003


On Sat, 26 Jul 2003 06:42, Peter Rosa wrote:
> > Well, I have tried it. When I type exactly the same command
> > awk -F: '$3==0 {print $1,$3}' /etc/master.passwd | tee /dev/stderr |
>
> sed -e
>
> > '/^root 0$/d' -e '/^toor 0$/d' | wc -l
> > at prompt, it works well. So the error must be around [ -gt 0 -a -lt 1 ]
>

Of course ...    [ -gt 0 -a -lt 1 ] is not a valid test!
Its not valid because $n expanded to blank in source:
      [ $n -gt 0 -a $rc -lt 1 ]

Also something wrong with $rc

[snip]

> >
> > separator
> > echo 'Checking for uids of 0:'
> > n=$(awk -F: '$3==0 {print $1,$3}' /etc/master.passwd |
> >     tee /dev/stderr |
> >     sed -e '/^root 0$/d' -e '/^toor 0$/d' |
> >     wc -l)
> > [ $n -gt 0 -a $rc -lt 1 ] && rc=1
> >
 
Malcolm Kay


More information about the freebsd-questions mailing list