Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save thiagorider/e89a3bae2a07f32632ce60bc78c745a0 to your computer and use it in GitHub Desktop.

Select an option

Save thiagorider/e89a3bae2a07f32632ce60bc78c745a0 to your computer and use it in GitHub Desktop.
Bash script snippets - Correct number of parameters
#!/bin/sh
E_WRONG_ARGS=85
script_parameters="-a -h -m -z"
# -a = all, -h = help, etc.
if [ $# -ne $Number_of_expected_args ]
then
echo "Usage: `basename $0` $script_parameters"
# `basename $0` is the script's filename.
exit $E_WRONG_ARGS
fi
@thiagorider
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment