example-script/example.sh

25 lines
294 B
Bash
Raw Normal View History

2022-07-07 22:50:56 +02:00
#! /bin/bash
2022-07-07 23:17:36 +02:00
case "$@" in *--opt-1*|*-h*)
2022-07-07 22:50:56 +02:00
echo OPT_1
2022-07-07 23:17:36 +02:00
exit 0;
2022-07-07 22:50:56 +02:00
esac
case "$@" in *--opt-2*)
2022-07-08 20:10:03 +02:00
OPT_2=true
2022-07-07 22:50:56 +02:00
esac
2022-07-08 20:10:03 +02:00
if [ $OPT_2 ]
then echo $OPT_2
fi
2022-07-07 22:50:56 +02:00
case "$@" in *--opt-3*)
echo OPT_3
2022-07-08 20:10:03 +02:00
opti_3=avoid
2022-07-07 22:50:56 +02:00
esac
2022-07-08 20:10:03 +02:00
if [ $opti_3 = avoid ]
then echo opti_3 was avoided
else echo opti_3 was automated
fi