Skip to content
Browse files

fixed waiting for input when -h option given

  • Loading branch information...
1 parent 88ce296 commit 6f896a0101a869ace4b0a31f9e00bfd96ac54a38 @micha committed Jul 7, 2009
Showing with 7 additions and 3 deletions.
  1. +7 −3 jsawk
View
10 jsawk
@@ -971,7 +971,7 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
var inputLines = argv.shift();
var usage = function() {
- err("Usage: jsq [-n] [-f jsfile1.js]* [-q jsonquery] [-d delim] "+
+ err("Usage: jsq [-n] [-f jsfile1.js]* [-q jsonquery] "+
"[-b script] \\\n"+
" [-a script] [-v NAME=VALUE] [script]");
quit(1);
@@ -1075,8 +1075,12 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
})(arguments);
__END__
-echo "$(cat 2>/dev/null)" > $TMP2
-nlines=$(grep -c '$' $TMP2 2>/dev/null || echo 0)
+nlines=0
+
+if [ "$1" != "-h" ]; then
+ echo "$(cat 2>/dev/null)" > $TMP2
+ nlines=$(grep -c '$' $TMP2 2>/dev/null || echo 0)
+fi
res=$(cat $TMP2 2>/dev/null | js $TMP1 $nlines "$@")
ret=$?

0 comments on commit 6f896a0

Please sign in to comment.
Something went wrong with that request. Please try again.