From owner-freebsd-questions@FreeBSD.ORG Wed Aug 29 18:55:53 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 F3A4C16A417 for ; Wed, 29 Aug 2007 18:55:52 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 51CC513C45B for ; Wed, 29 Aug 2007 18:55:51 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (vader.bytemobile.ondsl.gr [83.235.244.135]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-8) with ESMTP id l7TItOeY011287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 29 Aug 2007 21:55:41 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l7TIsuMJ016186; Wed, 29 Aug 2007 21:55:18 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l7TIspTH016174; Wed, 29 Aug 2007 21:54:51 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 29 Aug 2007 21:54:51 +0300 From: Giorgos Keramidas To: Wojciech Puchar Message-ID: <20070829185450.GA15895@kobe.laptop> References: <01a901c7ea3d$0ad62720$1e00a8c0@cheqsoft.local> <20070829185012.A14865@wojtek.tensor.gdynia.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070829185012.A14865@wojtek.tensor.gdynia.pl> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.953, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.45, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: 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 18:55:53 -0000 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.