tool [args] 2>&1 | less
Presumably "less" knows how big your terminal is. tool [args] 2>&1 | less
Presumably "less" knows how big your terminal is. tool 2>&1 | less
can be replaced by tool |& less $ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
on the off chance anyone was curious/didn't remember. Yes, I have $HOMEBREW_PREFIX/bin/bash and it's 5.2.15In that same vein, I wondered if that syntax was supported in zsh since modern macOS went whole hog and ... I gained one more pebble on the huge pile of steaming turds why I detest zsh
$ /bin/zsh -exc '{ echo alpha; echo beta; } |& wc -l'
+zsh:1> wc -l
4
dafuq? $ /bin/zsh -exc '{ echo alpha; echo beta; } |& cat'
+zsh:1> cat
+zsh:1> echo alpha
alpha
+zsh:1> echo beta
beta
oh, aren't you just the funniest. har. de. har. XTRACE (-x, ksh: -x)
Print commands and their arguments as they are executed.
So if you use "zsh -ec" does it still surprise you?-x is the most invaluable tool in my shell-debugging toolkit. It is great to see every command evaluated and run alongside the script output itself. I use it multiple times per day at work.
Alternatively, tools could build in pagers for fewer pipeline surprises, like the all-encompassing systemd.
Even better, I could envision a framework where any tool that produces output can be automatically subject to pagination, with auto terminal detection and the whole bit. Think of libreadline but for output. You could thereby eliminate plenty of ad hoc hacks.