Last active
July 20, 2020 15:32
-
-
Save gideonaina/2d5caf3f5ae5b8c098b7388254b36b34 to your computer and use it in GitHub Desktop.
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 | |
# assign variables | |
ACTION=${1} | |
function create_file() { | |
touch "${1}-54321" | |
} | |
function display_help() { | |
cat << EOF | |
Usage: ${0} {-c|--create|-h|--help} <filename> | |
OPTIONS: | |
-c | --create Create a new file | |
-h | --help Display the command help | |
Examples: | |
Create a new file: | |
$ ${0} -c foo.txt | |
Display help: | |
$ ${0} -h | |
EOF | |
} | |
case "$ACTION" in | |
-h|--help) | |
display_help | |
;; | |
-c|--create) | |
create_file "${2:-server}" | |
;; | |
*) | |
echo "Usage ${0} {-c|-h}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment