From c43e7ad8741ae381633a33e8213fdfb74bfc6ce6 Mon Sep 17 00:00:00 2001 From: Tharre Date: Mon, 28 May 2018 22:42:40 +0200 Subject: Add capture_output script --- bin/capture_output | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 bin/capture_output (limited to 'bin/capture_output') diff --git a/bin/capture_output b/bin/capture_output new file mode 100755 index 0000000..8645f3f --- /dev/null +++ b/bin/capture_output @@ -0,0 +1,15 @@ +#!/bin/bash -e + +if ! [ -x "$(command -v pbpst)" ]; then + echo 'Error: pbpst is not installed' >&2 + exit 1 +fi + +if [ $# -eq 0 ]; then + echo 'Error: no arguments supplied' >&2 + exit 1 +fi + +# sed removes all of the coloring, and (hopefully) all the other escape +# sequences that col doesn't deal with well. +script -qfe >(sed 's:\x1B\[[0-9;?]*[mKJl]::g; 1d; $d' | col -bx | pbpst -S -x1d) -c "$*" -- cgit v1.2.3-70-g09d2