Follow

I'm not giving out any free baklavas but if you need a bash one-liner hmu

Β· Β· Moa Β· 1 Β· 0 Β· 1

@jb55 I need to both print the results of a command to stdout and have it exit 1 unless the last line says β€œNo cycles found.”

@alex (cmd | tee output | grep "No cycles found" | tail -n1) & tail -f output

@alex uhhh forgot the printing bit:

awk '{print $0} END{exit ($0 != "No cycles found")}'

I shouldn't do these when I'm day drinking

@alex @jb55 If you have moreutils installed, you can use one of the best-named commands, pee (tee but with pipes):

echo -e 'no cycles found on penultimate line\nno cycles found on ultimate line' | pee 'cat' 'tail -n1 | grep -qv "no cycles found"' ; echo $?

Sign in to participate in the conversation
Bitcoin Mastodon

Bitcoin Maston Instance