Created
December 30, 2021 06:05
-
-
Save KathanP19/20e9ec4d6e51418f574245a3b3cf106f to your computer and use it in GitHub Desktop.
Revisions
-
KathanP19 created this gist
Dec 30, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ #!/bin/bash function first(){ echo "First Function"; } function second(){ echo "Second Function"; } function third(){ echo "Third Function"; } while [ -n "$1" ]; do case "$1" in first) first; OPTIND=2 while getopts "lo:" opt; do case "${opt}" in l) echo "Passsed In Option of First FUnction"; ;; o) echo "$OPTARG" ;; esac done break ;; second) second; OPTIND=2 while getopts "l" opt; do case "${opt}" in l) echo "Passsed In Option of second FUnction"; ;; esac done break ;; -help|--help|-h) echo "Usage: "; echo -e " $0 first -l -o Argument_to_Param"; echo -e " $0 second -l"; exit 2;; *) if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'"; fi ;; esac shift done