diff --git a/dependencies.sh b/dependencies.sh new file mode 100644 index 0000000..9b845ed --- /dev/null +++ b/dependencies.sh @@ -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 diff --git a/example.sh b/example.sh index 26f2d46..5d7aeac 100755 --- a/example.sh +++ b/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