Error handling in shell scripts

main
Elbert Alias 10 years ago
parent 2c81f63146
commit ea1f3553cb

@ -7,14 +7,9 @@ then
exit 1
fi
wappalyzer validate
if [ $? -ne 0 ]
then
echo "Build aborted"
set -eu
exit 1
fi
wappalyzer validate
echo "Prettifying apps.json..."

@ -14,6 +14,8 @@ then
path=$WAPPALYZER_ROOT
fi
set -eu
if [ ! -d $path/src ]
then
echo "-$(basename $0): Incorrect path"
@ -55,6 +57,6 @@ ln -f $path/apps.json $path/drivers/ruby
ln -f $path/wappalyzer.js $path/drivers/npm
ln -f $path/apps.json $path/drivers/npm
echo "Done"
echo "OK"
exit 0

@ -1,9 +1,5 @@
#!/bin/bash
color_ok='\033[1;32m'
color_err='\033[0;31m'
color_none='\033[0m'
path=$1
if [ -z $path ]
@ -18,6 +14,8 @@ then
path=$WAPPALYZER_ROOT
fi
set -eu
if [ ! -d $path/src ]
then
echo "-$(basename $0): Incorrect path"
@ -29,17 +27,4 @@ path="$path/src"
echo "Validating apps.json..."
echo -en "${color_err}"
jsonlint --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json
if [ $? -eq 0 ]
then
echo -e "${color_ok}Ok${color_none}"
exit 0
else
echo -en "${color_none}"
exit 1
fi

Loading…
Cancel
Save