Script Test [OT]

Luciano Rocha strange at nsk.no-ip.org
Sat Sep 6 08:34:35 UTC 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080906/6d3af2cd/attachment-0001.sig>


More information about the fedora-list mailing list