[ale] shell scripting
Ken Nagorski
kenn at pcintelligent.com
Wed Nov 15 21:08:23 EST 2000
hi there,
Thanks, what I actually ended up doing was taking out the 127 and
replacing it with 1 cause I wanted anyhting that wasn't in
shared-ips... but that got things going in the right direction. I also
axed the && echo "$d" so I could pipe it through wc and find do some
addition to check that I was getting the right number.
original list
- ones already added
--------------
= output from script (which it did)
However I am a little confused by the 127, why is it that if I say
grep something file, from the prompt I get 0 as an exit status and 127 if
I do it in a script. Anyone know?
Thank you
Ken
On Wed, 15 Nov 2000, Yu, Jerry wrote:
> grep "$d" shared-ips > /dev/null 2>&1 && echo "$d"
>
> would be more concise.
>
> treat it as a string: [ "$?" = "127" ]
> treat it as a number: [ "$?" eq 127 ]
>
>
> #-----------snip------------------------------
> #
> ##!/bin/bash
> #
> #for d in `less domains`
> #do
> # `grep $d shared-ips`
> # if [ $?==127 ]
> # then
> # echo "$d"
> # fi
> #done
> #A
> #
> #--
> #To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
> #
>
> Jerry Z. Yu mailto: z.yu at ptek.com
> Systems Engineer https://punch
> PTEK Holdings, Inc. +1-404-262-8544 (O)
>
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
More information about the Ale
mailing list