Browse Source

Fortify command, file and pipe delimiters

Often it helps to see better where output begins or end exactly.
Alois Mahdal 4 years ago
parent
commit
42621995c2
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      src/include-bash/pretty.sh

+ 8
- 6
src/include-bash/pretty.sh View File

@@ -378,11 +378,10 @@ _pretty__echo_cmd() {
378 378
     #
379 379
     # Print command line, launch it and report exit status
380 380
     #
381
-    local c=\$
382
-    test "$(id -u)" -eq 0 && c="#"
383
-    echo "$c $*"
384
-    "$@"
385
-    echo "^ exit status: $?"
381
+    local es
382
+    echo "-- begin command $* --"
383
+    "$@"; es=$?
384
+    echo "-- end command ($es) $* --"
386 385
 }
387 386
 
388 387
 
@@ -393,10 +392,13 @@ _pretty__echo_files() {
393 392
     local fp
394 393
     for fp in "$@"; do
395 394
         if test "$fp" = "-"; then
395
+            echo "-- begin pipe --"
396 396
             cat
397
+            echo "-- end pipe --"
397 398
         elif test -s "$fp" || test "$fp" = "/dev/stdin"; then
398
-            echo "-- $fp --"
399
+            echo "-- begin file $fp --"
399 400
             cat "$fp"
401
+            echo "-- end file $fp --"
400 402
         fi
401 403
     done
402 404
 }