Commit 054a836a authored by Vincent Pelletier's avatar Vincent Pelletier

parallel_parse: Check argument count before accessing arguments.

parent cd70bb49
...@@ -12,7 +12,12 @@ usage() { ...@@ -12,7 +12,12 @@ usage() {
echo " bin/apachedex --period week" echo " bin/apachedex --period week"
} }
if [ $1 = '-h' -o $1 = '--help' ]; then if [ $# -lt 4 ]; then
usage
exit 1
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage usage
exit 0 exit 0
fi fi
...@@ -25,11 +30,6 @@ shift ...@@ -25,11 +30,6 @@ shift
OUT_FILE=$1 OUT_FILE=$1
shift shift
if [ $# -eq 0 ]; then
usage
exit 1
fi
# XXX: any simpler way ? # XXX: any simpler way ?
xargs -0 -r -n 1 -P $PARALLELISM -I "@FILE@" -- "$SHELL" -c 'INFILE="$1";shift;STATE_DIR="$1";shift;echo -n .;"$@" -Q --format json --out "$STATE_DIR/$(sed s:/:@:g <<< "$INFILE").json" "$INFILE"' "$0" "@FILE@" "$STATE_DIR" "$@" xargs -0 -r -n 1 -P $PARALLELISM -I "@FILE@" -- "$SHELL" -c 'INFILE="$1";shift;STATE_DIR="$1";shift;echo -n .;"$@" -Q --format json --out "$STATE_DIR/$(sed s:/:@:g <<< "$INFILE").json" "$INFILE"' "$0" "@FILE@" "$STATE_DIR" "$@"
echo echo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment