Re: Script Test [OT]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 06, 2008 at 02:27:27AM -0600, kwhiskerz wrote:
> This is OT, but perhaps someone knows an answer.
> 
> Is there a way a script can determine which computer it is running on and 
> refuse to run if it is on the wrong computer?
> 
> if [ some case ]; then

if [ "$(hostname -s)" = "puter" ]; then
  echo running
fi

Or, for multiple cases:

case "$(hostname -s)" in
  ws*)
    do_something
    ;;
  db*|app*)
    do_other
    ;;
esac

-- 
lfr
0/0

Attachment: pgpgT530GyL03.pgp
Description: PGP signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux