Skip to content

Instantly share code, notes, and snippets.

@nirgeier
Created May 4, 2020 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nirgeier/6d5ff005b081e724fe0e12945ffa939b to your computer and use it in GitHub Desktop.
Save nirgeier/6d5ff005b081e724fe0e12945ffa939b to your computer and use it in GitHub Desktop.
dummy
# without `:` the values are optionals
while getopts abc flag;
do
case "${flag}"
in
a ) echo $optarg ; pa="$OPTARG"; echo $pa;;
b ) pb=${OPTARG};;
c ) pc=${OPTARG};;
\?) echo "Invalid option: kubde" 1>&2 ;;
: ) echo "Invalid option: $OPTARG requires an argument" 1>&2;;
esac
done
echo 'P1:' "$pa"
echo $P2
echo $P3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment