Explorar el Código

Work properly with '-' or /dev/stdin

/dev/stdin will be treated as normal file, albeit `test -s` would detect
it as non-existent.  '-' will cause STDIN to be used as wellm but will
omit header.
Alois Mahdal hace 9 años
padre
commit
89b02aacc0
Se han modificado 1 ficheros con 8 adiciones y 3 borrados
  1. 8
    3
      src/include/pretty.sh

+ 8
- 3
src/include/pretty.sh Ver fichero

@@ -335,9 +335,14 @@ _pretty__echo_files() {
335 335
     local fp
336 336
     for fp in "$@";
337 337
     do
338
-        test -s "$fp" || continue
339
-        echo "-- $fp --"
340
-        cat "$fp"
338
+        if test "$fp" = "-";
339
+        then
340
+            cat
341
+        elif test -s "$fp" || test "$fp" = "/dev/stdin";
342
+        then
343
+            echo "-- $fp --"
344
+            cat "$fp"
345
+        fi
341 346
     done
342 347
 }
343 348