3 ms·
>I found that when the output is piped it doesn't invoke the pager. This seems reasonable to me. This might be less being smart and getting out of the way. Fr
by patzerhacker 12y ago
>I found that when the output is piped it doesn't invoke the pager. This seems reasonable to me.
This might be less being smart and getting out of the way. From http://en.wikipedia.org/wiki/Less_%28Unix%29#Usage http://en.wikipedia.org/wiki/Less_%28Unix%29#Usage:
>By default, less displays the contents of the file to the standard output (one screen at a time). If the file name argument is omitted, it displays the contents from standard input (usually the output of another command through a pipe). If the output is redirected to anything other than a terminal, for example a pipe to another command, less behaves like cat.
- Mister_Snuggles 12y agoThat could be, but the change in wrapping behaviour makes me think it's journalctl doing it. If less acts like cat when the output is a pipe, then it wouldn't be wrapping at 80 columns, so journalctl must be doing the wrapping in that scenario.
- thyrsus 12y agojournalctl | cat ...would cause less to act like cat and cat to, well, :-), and then the tty driver usually wraps from the last column to the first.
- Mister_Snuggles 12y agoSorry, when I said "wrap" I should have said "truncate". journalctl truncates at the width of my terminal or at 80 columns if the output is not to a terminal.
- thwarted 12y agoyum does the same thing. I actually looked at the code and it always assumes the output width is 80 characters and wraps or center…truncates if output isn't a terminal. It also doesn't properly sort its output, so you're tempted to use `yum search | sort`, which ends up with indented lines at the top of the output. Of course, the recommended thing to do is use a different program for scripts/pipelines rather than yum, so now there are two different interfaces that need to be remembered. yum looks like a terminal-friendly program, but actually isn't. https://bugzilla.redhat.com/show_bug.cgi?id=584525 https://bugzilla.redhat.com/show_bug.cgi?id=584525 https://bugzilla.redhat.com/show_bug.cgi?id=986740 https://bugzilla.redhat.com/show_bug.cgi?id=986740