scripts/awk
branchv_0
changeset 27 86d8bbc99e7b
parent 16 4e8fe4cc70f0
child 29 b3d1a671315b
--- a/scripts/awk	Thu May 23 23:35:52 2019 +0200
+++ b/scripts/awk	Sat May 25 11:36:31 2019 +0200
@@ -47,9 +47,17 @@
 	done | relpipe-in-cli generate-from-stdin args 2 i integer value string | relpipe-out-tabular
 }
 
+realAWK() {
+	/usr/bin/awk "$@"
+	echo "$?" > "$logDir/awk-status.log"
+}
+
 formatArgsTxt "$@" > "$logDir/awk-args.log";
 
-tee "$logDir/awk-stdin.log" | /usr/bin/awk "$@" 2> "$logDir/awk-stderr.log" | tee "$logDir/awk-stdout.log";
+tee "$logDir/awk-stdin.log" | realAWK "$@" 2> "$logDir/awk-stderr.log" | tee "$logDir/awk-stdout.log";
+
+cat "$logDir/awk-stderr.log" >&2;
+exit `cat "$logDir/awk-status.log"`;
 
 # Use e.g. GNU Screen with four windows to watch files:
 # watchFile() { while inotifywait "$1" &>/dev/null ; do clear; cat "$1" ; done; }