[X-Unix] Setting variables for hide script
Eugene Lee
list-themacintoshguy at fsck.net
Fri Mar 26 11:57:46 PST 2004
On Fri, Mar 26, 2004 at 04:41:48PM +0100, Kirk McElhearn wrote:
:
: To those fiddling with this script....
:
: There is an error arising whenever there is only one argument in the script.
: Since the osascript command understands "$1" and "$2", would it be easier to
: set these two variables at the beginning of the script, before it has a
: chance to act on them in the Tell Finder bit, then use variable names? Call
: them, say, opt and app?
Of course. A simplistic solution (I would write something more robust,
but that's just me) would look like this:
if [ $# -eq 1 ]; then
opt=""
app="$1"
elif [ $# -eq 2 ]; then
opt="$1"
app="$2"
else
echo "Usage: `basename $0` [option] appname"
exit 1
fi
--
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/
More information about the X-Unix
mailing list