From owner-freebsd-questions Wed Feb 20 13:18:54 2002 Delivered-To: freebsd-questions@freebsd.org Received: from brain-stream.com (brain-stream.com [209.95.107.206]) by hub.freebsd.org (Postfix) with ESMTP id 2DBC437B41D for ; Wed, 20 Feb 2002 13:18:17 -0800 (PST) Received: from pantalaimon.pobox.com (h00609708e398.ne.mediaone.net [24.128.187.79]) by brain-stream.com (8.9.3/8.9.3) with ESMTP id NAA01885 for ; Wed, 20 Feb 2002 13:18:06 -0800 (PST) Message-Id: <5.1.0.14.2.20020220160637.02763050@pop.earthlink.net> X-Sender: bdelong@pop.earthlink.net (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 20 Feb 2002 16:17:57 -0500 To: questions@freebsd.org From: "B.K. DeLong" Subject: BASH programming question Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hey all - I'm somewhat new to the world of BASH scripting. I'm trying to write a script that I can throw in cron to check if my IP has changed. However, I'm having problems with the variable. What I'm trying to say, is "if $IP is not null then email me" ie. if diff produces no results, then the IP is the same. However, I can't quite figure out the way to define this without getting a "too many arguments" error. #!/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 Thanks in advance for any tips. -- B.K. DeLong bkdelong@pobox.com 617.877.3271 http://www.brain-stream.com Play. http://www.the-leaky-cauldron.org Potter. http://www.attrition.org Security. http://www.artemisiabotanicals.com Herb. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message