added an example
This commit is contained in:
parent
47fe3064b5
commit
ab7fc0e8ee
16
dependencies.sh
Normal file
16
dependencies.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Check dependencies
|
||||
# It mutes the output but verifies if the command returns an error
|
||||
# if that's true, then the process can't continue
|
||||
command -v inkscape >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'inkscape'"; DEPSCOMPLETE=no; }
|
||||
command -v parallel >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'parallel'"; DEPSCOMPLETE=no; }
|
||||
command -v bashash >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'bashash'"; DEPSCOMPLETE=no; }
|
||||
command -v conqueror >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'conqueror'"; DEPSCOMPLETE=no; }
|
||||
command -v cacacaca >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'cacacaca'"; DEPSCOMPLETE=no; }
|
||||
command -v shnt >/dev/null 2>&1 || { echo >&2 "I cannot continue without 'shnt'"; DEPSCOMPLETE=no; }
|
||||
|
||||
# here is the checking. it is sepparated for practicy
|
||||
if [ DEPSCOMPLETE = no ]
|
||||
then exit 1
|
||||
fi
|
12
example.sh
12
example.sh
@ -6,9 +6,19 @@ case "$@" in *--opt-1*|*-h*)
|
||||
esac
|
||||
|
||||
case "$@" in *--opt-2*)
|
||||
echo OPT_2
|
||||
OPT_2=true
|
||||
esac
|
||||
|
||||
if [ $OPT_2 ]
|
||||
then echo $OPT_2
|
||||
fi
|
||||
|
||||
case "$@" in *--opt-3*)
|
||||
echo OPT_3
|
||||
opti_3=avoid
|
||||
esac
|
||||
|
||||
if [ $opti_3 = avoid ]
|
||||
then echo opti_3 was avoided
|
||||
else echo opti_3 was automated
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user