31 lines
448 B
Plaintext
31 lines
448 B
Plaintext
#
|
|
# This file contains useful Bash functions
|
|
# and can be "source"d from the scripts.
|
|
#
|
|
|
|
declare -a POSITIONAL_ARGS
|
|
for a in "$@" ; do
|
|
OPTION_COUNT+=1
|
|
case "$a" in
|
|
--*=*)
|
|
[[ $a =~ --([^=]+)=(.*) ]]
|
|
l=${BASH_REMATCH[1]//-/_}
|
|
r=${BASH_REMATCH[2]}
|
|
eval ${l^^}=\"$r\"
|
|
;;
|
|
--*)
|
|
[[ $a =~ --(.+) ]]
|
|
l=${BASH_REMATCH[1]//-/_}
|
|
eval ${l^^}=1
|
|
;;
|
|
*)
|
|
POSITIONAL_ARGS+=($a)
|
|
;;
|
|
esac
|
|
done
|
|
|
|
runner() {
|
|
( set -x ; ${@} )
|
|
}
|
|
|