← Back to context

Comment by inetknght

3 hours ago

Yeah no. If I wanted to use a pager, I'd use a pager.

I want the output visible on screen after I exit the pager. If I didn't want it on screen, I'd pipe it to a file and open that in a text editor. That will disappear when I close the file. As a bonus: I can then use grep without having to repeat whatever command I used.

Even more importantly: I want the command to behave identically regardless of whether its stdin or stdout is /dev/null or a terminal or a socket or a serial port or a pipe or anything else that it can read or write with. Try writing a script when the tools themselves change how they behave whether they're running in a script or in a terminal or elsewhere. It kinda sucks.

You make a reasonable point so I don't want to oppose it but just to offer more tricks in case some of you don't know them:

_less_ has a nice "&" command that is like "/" (search) but that filters instead like grep.

You can also pipe to an external command from less

> Try writing a script when the tools themselves change how they behave whether they're running in a script or in a terminal

But we smart coders. We think everything. Remind me later.