Created
February 27, 2023 05:28
-
-
Save suchoudh/7527cb15336b4799f2b839fcdbaa5b41 to your computer and use it in GitHub Desktop.
usings options in a bash script for BoD and EoD processes
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/bash | |
| usage() { echo "$0 usage:" && grep " .)\ #" $0; exit 0; } | |
| [ $# -eq 0 ] && usage | |
| while getopts ":hs:b:e:" arg; do | |
| case $arg in | |
| b) # Specify b value. | |
| echo "runningBoD is ${OPTARG}" | |
| ./BoD.sh | |
| ;; | |
| e) # Specify e value. | |
| echo "runningEoD is ${OPTARG}" | |
| ./EoD.sh | |
| ;; | |
| s) # Specify strength, either 45 or 90. | |
| strength=${OPTARG} | |
| [ $strength -eq 45 -o $strength -eq 90 ] \ | |
| && echo "Strength is $strength." \ | |
| || echo "Strength needs to be either 45 or 90, $strength found instead." | |
| ;; | |
| h | *) # Display help. | |
| usage | |
| exit 0 | |
| ;; | |
| esac | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remember line 4 is different for hs and for b, e