X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=brc2;h=56f4db6c860d4ff83bb91a254ab3a0eb683e33cf;hp=891e0953b668e7e69d847f54e5f4ad24f768fff5;hb=7f759d320592e791a62cd0a966350e8c53ee0976;hpb=165008e5b82c81ebff1061c8f8294c3bc6e9dced diff --git a/brc2 b/brc2 index 891e095..56f4db6 100644 --- a/brc2 +++ b/brc2 @@ -141,18 +141,20 @@ bigclock() { } _jrun() { # journal run. run args, log to journal, tail and grep the journal. + # Redirect all commands which might have stderr to stdout because of + # wrapping. local pid pattern jr_pid sedscript cmd_name ended ret=0 case $1 in -p) - pattern="$2\|" + pattern="$2|" shift 2 ;; esac cmd_name=${1##*/} systemd-cat -t "$cmd_name" "$@" 2>&1 & pid=$! - sedscript="/$pattern$cmd_name/p;/^.{16}[^ ]+ $cmd_name\[$pid]: ([^ ]+ +)?exiting with status [0-9]+\$/q" + sedscript="/$pattern$cmd_name/p;/^.{16}[^ ]+ $cmd_name\[$pid]: $cmd_name: exiting with status [0-9]+\$/q" journalctl -S "4 seconds ago" -f |& sed -nr "$sedscript" 2>&1 & jr_pid=$! wait $pid 2>&1 || ret=$? @@ -355,6 +357,8 @@ envload() { # load environment from a previous: export > file done < "$file" } +failfunc() { asdf a b c; } +failfunc2() { failfunc d e f; } # one that comes with distros is too old for newer devices fastboot() { @@ -809,7 +813,7 @@ resolvcat() { #hr; echo dnsmasq is $(systemctl is-active dnsmasq) f=/var/run/dnsmasq/resolv.conf hr; echo $f:; ccat $f - hr; m grr '^ *servers-file *=' /etc/dnsmasq.conf /etc/dnsmasq.d + hr; m grr '^ *(servers-file|server) *=|^ *no-resolv *$' /etc/dnsmasq.conf /etc/dnsmasq.d f=/etc/dnsmasq-servers.conf hr; echo $f:; ccat $f }