4 ms·
I think the suggestion was not that the tool should page the output, but that the user can easily do so: tool [args] 2>&1 | less Presumably "less" knows h
by _kst_ 3y ago
I think the suggestion was not that the tool should page the output, but that the user can easily do so:
tool [args] 2>&1 | less
Presumably "less" knows how big your terminal is.
- NoZebra120vClip 3y agoBut in an ideal world, if every tool is careful to restrict it to one page or less, you'd literally never need a pager anymore. 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.
- fragmede 3y agobtw, as of Bash 5.0 tool 2>&1 | less can be replaced by tool |& less
- mdaniel 3y ago$ /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.15 In 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.
- NoZebra120vClip 3y agoI'm not sure that I follow: you chose options "-exc" so: 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.