Re: Checking for existence of command prior to execution

From: Tom Hardy (rhardy_at_visi.com)
Date: 06/17/04


Date: Thu, 17 Jun 2004 11:07:14 -0500

Travis L Spencer wrote:

> In article <2jbm01FudsghU1@uni-berlin.de>, Chris F.A. Johnson wrote:
>>
>> Note that $CMD != $CWD != $cmd
>>
>
> True, but the original problem still remains. Any other suggestions?

Suse does a lot of checks like the following:

#
# Now set system time if we have some NTP servers
# and no running xntp.
#
while true ; do
    set -- $(runlevel)
    test -e /etc/init.d/rc${2}.d/S*xntpd && break
    test -x /usr/sbin/ntpdate || break
    checkproc /usr/sbin/xntpd &> /dev/null && break
    /usr/sbin/rcxntpd ntptimeset
    break
done

-- 
Tom Hardy  <*>  rhardy@visi.com  <*>  http://www.visi.com/~rhardy
  Just don't create a file called -rf. --Larry Wall


Relevant Pages