next up previous
Next: perl Up: Scripting Previous: general notes

shell

As an example, let's say you want a script to open a URL from the command line. Put the following in a file called open-url.sh:
#!/bin/sh
# open-url -- the Bourne-shell version
# usage: open-url URL
browser=${BROWSER:-netscape}
if [ $# -lt 1 ]; then
    echo usage: open-url URL 1>&2
    exit 1
fi
$browser -remote "openUrl($1)" || $browser $1

Then type
$ chmod 755 open-url.sh

And now: $ open-url.sh http://dasher.wustl.edu/~reece/ &

If a netscape is running, it'll get sent the remote command; if not, a new one will be started.



Reece Kimball Hart
1998-03-18