Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Feb 2002 00:02:24 +0100
From:      Florian Nigsch <flo@nigsch.com>
To:        "B.K. DeLong" <bkdelong@pobox.com>, freebsd-questions@freebsd.org
Subject:   Re: BASH programming question
Message-ID:  <20020221000224.A32489@nigsch.com>
In-Reply-To: <5.1.0.14.2.20020220165911.01e189a0@pop.earthlink.net>; from bkdelong@pobox.com on Wed, Feb 20, 2002 at 05:00:03PM -0500
References:  <5.1.0.14.2.20020220160637.02763050@pop.earthlink.net> <5.1.0.14.2.20020220160637.02763050@pop.earthlink.net> <20020220224520.A31541@nigsch.com> <5.1.0.14.2.20020220165911.01e189a0@pop.earthlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
hi!

you should use $(command) - it's the same as the backquotes `` which
are only provided in bash 2* for backwards compatibility to bash 1*

also, like in the other mail from xxx (dont remember..) you can use
the exit status of the diff in the if structure like this:

if diff file1 file2; then echo "no difference"; fi

this works if diff returns zero on no differences found (which should
be the case anyway)

see diff(1)

On Wed, Feb 20, 2002 at 05:00:03PM -0500, B.K. DeLong wrote:
> >On Wed, Feb 20, 2002 at 04:17:57PM -0500, B.K. DeLong wrote:
> > > #!/usr/local/bin/bash -x
> > > ifconfig | grep "inet " | cut -f2 -d" " | grep 24. > /.newip
> > > IP='diff /.newip /.currentip'
> > >
> > > if [ $IP <> null ]; then
> > >            cat /.newip > /.currentip;
> > >          mail -s "New IP" bkdelong@pobox.com < /.currentip;
> > >          echo "A New IP has been found"
> > > exit 0
> > > fi
---end quoted text---

-- 

---
Florian Nigsch <flo@nigsch.com>
http://flo.nigsch.com/
PGP key: http://flo.nigsch.com/fnigsch.asc

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020221000224.A32489>