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() {
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
exit 0
fi
......@@ -25,11 +30,6 @@ shift
OUT_FILE=$1
shift
if [ $# -eq 0 ]; then
usage
exit 1
fi
# 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" "$@"
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