Added missing runall script

This commit is contained in:
2018-06-05 09:53:57 -05:00
parent f23031c8e3
commit b7130cccc5
2 changed files with 44 additions and 3 deletions

39
SNAP/runall Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
usage () {
echo "Usage: ${0#*/} [DIRECTORY]..."
echo "Run all executable scripts in one or more directories"
exit $1
}
ERRORS=
if [ -z "$1" ]; then
usage 2
fi
for dir in "$@"; do
dir=${dir%/}
if [ ! -d "$dir" ]; then
echo "$dir: invalid directory"
usage 2
fi
for file in "$dir"/*; do
if [ -x "$file" ]; then
"$file"
if [ "$?" -gt 0 ]; then
ERRORS="$ERRORS $file"
fi
fi
done
done
if [ -n "$ERRORS" ]; then
echo "There were errors in the following scripts:$ERRORS"
exit 1
fi