Created
September 12, 2016 20:55
-
-
Save thiagorider/e89a3bae2a07f32632ce60bc78c745a0 to your computer and use it in GitHub Desktop.
Bash script snippets - Correct number of parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snippet from http://tldp.org/LDP/abs/html/sha-bang.html