[X-Unix] Hiding apps from the command line
Eugene Lee
list-themacintoshguy at fsck.net
Fri Mar 26 11:44:42 PST 2004
On Fri, Mar 26, 2004 at 05:05:10PM +0000, Stroller wrote:
:
: Also, if you're going to use $1 ...$9... as variables in your script,
: it's also worth including this line in the script before you do so:
: if [ -z "$1" ]
: then
: echo "ERROR! This script requires a commandline argument, silly!"
: >&2
: exit 1
: fi
Even better, let the shell count the number of arguments:
if [ $# -eq 0 ]; then
echo "Usage: `basename $0` blah blah blah"
exit 1
fi
: Also, check out the `getopts` construct on pages 138 - 139 of the
: Advanced Bash???Scripting Guide (free download from the LDP).
OS X ships with getopt(1).
--
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/
More information about the X-Unix
mailing list