Tuesday, February 14, 2012

Linux:shell see if arg1 has been provided

An easy way to tell if arg1 has been given when user called the script:

# Note the quotes around $1

if [ -z "$1" ]; then
    usage
else
    do-something
fi

No comments:

Post a Comment