-
Using the help flag
bash example.sh -h Usage: bash example.sh -n Willy --gender male -a 99 --person_name | -n [Willy] What is your name? --age | -a [Required] --gender | -g [Required] --location | -l [chocolate-factory] insert your location
-
Using default values
$ bash example.sh -a 99 --gender male Name: Willy Age: 99 Gender: male Location: chocolate-factory
-
Providing all arguments
$ bash example.sh -a 23 --gender male -l neverland -n meir Name: meir Age: 23 Gender: male Location: neverland
-
Providing an empty required argument
$ bash example.sh -a 99 --gender [ERROR] Empty argument: gender Usage: bash example.sh -n Willy --gender male -a 99 --person_name | -n [Willy] What is your name? --age | -a [Required] --gender | -g [Required] --location | -l [chocolate-factory] insert your location
-
Providing an unknown argument
$ bash example.sh -a 99 -u meir [ERROR] Unknown argument: -u Usage: bash example.sh -n Willy --gender male -a 99 --person_name | -n [Willy] What is your name? --age | -a [Required] --gender | -g [Required] --location | -l [chocolate-factory] insert your location
Created
July 24, 2020 10:54
-
-
Save unfor19/f625a76b48b0dd1279d445d9e05df2d6 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment