From owner-freebsd-questions@FreeBSD.ORG Wed Aug 29 19:18:44 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB93916A41A for ; Wed, 29 Aug 2007 19:18:44 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.232]) by mx1.freebsd.org (Postfix) with ESMTP id 750DB13C48E for ; Wed, 29 Aug 2007 19:18:44 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: by wx-out-0506.google.com with SMTP id i29so268587wxd for ; Wed, 29 Aug 2007 12:18:43 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=iBKviQaZvSWcB028QAJgB6lI1hhjZnECoRuumRp2jcL3bCacmR4mqzllcmRMqYtyhjo+z7IoyxLnllipqpUf9WF0IOcukN8rbhIqAtbq21F4SdvRke8+wHsyFnWrOhSp6kcCHfrhmf/NKK9iBlHEBGz8hBZD1DexD4gQekhh+Ts= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=iTKpwqFor1Cf1bec+LuPBCvEPJVa8Ewdr0nkHB8QhyoWLraPI2zWVZQCBMPMWZjSpZvi9bZZwuagnWUTs093hhJPvoslfQGh8lhB0+YO7B3OGXBcVciuXUd4xIDW3uQfir3P2AV3OpvdYscn730GabHcD6+aohBfKGpPhtWqnuE= Received: by 10.90.79.6 with SMTP id c6mr2966132agb.1188415123558; Wed, 29 Aug 2007 12:18:43 -0700 (PDT) Received: from ?10.0.0.14? ( [74.95.66.25]) by mx.google.com with ESMTPS id a70sm15335915pye.2007.08.29.12.18.13 (version=SSLv3 cipher=OTHER); Wed, 29 Aug 2007 12:18:13 -0700 (PDT) In-Reply-To: <20070829185450.GA15895@kobe.laptop> References: <01a901c7ea3d$0ad62720$1e00a8c0@cheqsoft.local> <20070829185012.A14865@wojtek.tensor.gdynia.pl> <20070829185450.GA15895@kobe.laptop> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <14ECFF9B-9559-4B45-B44B-8E030597B00C@gmail.com> Content-Transfer-Encoding: 7bit From: Eric Crist Date: Wed, 29 Aug 2007 14:18:02 -0500 To: Giorgos Keramidas X-Mailer: Apple Mail (2.752.3) Cc: Wojciech Puchar , freebsd-questions@freebsd.org, Hinkie Subject: Re: FreeBSD Cron Job to run (ifconfig em0 down; ifconfig em0 up) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2007 19:18:44 -0000 On Aug 29, 2007, at 1:54 PMAug 29, 2007, Giorgos Keramidas wrote: > On 2007-08-29 18:51, Wojciech Puchar > wrote: >> fragment from my test program (used for other thing but doesn't >> matter) >> >> /sbin/ping -i 0.5 -s 1450 -c 3 tested_host >/dev/null 2>/dev/null >> if [ $? != 0 ];then >> perform_action_if_doesnt_ping >> fi > > I'm not sure if '!=' is a 'portable' way to write sh(1) tests, > but you have a point there :-) > > Rewriting this as: > > #!/bin/sh > > ping -i 0.5 -s 1450 -c 3 tested_host >/dev/null 2>&1 > if test $? -eq 0 ; then > exit 0 > fi > > perform_action_if_doesnt_ping > > may save you an extra indentation level too. AFAIK, the != is evaluated by test, not sh. ----- Eric F Crist Secure Computing Networks