Skip to content

Instantly share code, notes, and snippets.

@dennbagas
Created March 19, 2020 05:54
Show Gist options
  • Save dennbagas/0d11be13d468e2fbcd763a192cc4fa11 to your computer and use it in GitHub Desktop.
Save dennbagas/0d11be13d468e2fbcd763a192cc4fa11 to your computer and use it in GitHub Desktop.
shell match every args
if [ $# -gt 0 ]; then
for i in "$@"
do
if [[ "$i" =~ ^--case1\S* ]]; then
local args;
args="${i#*=}"
elif [[ "$i" =~ ^--case2\S* ]]; then
local args;
args="${i#*=}"
fi
done
else
usage-help
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment