3 ms·
I typically run the command output through `cat` to see if it does different things when outputting to the terminal vs piping. The biggest changes are typicall
by kbrazil 5y ago
I typically run the command output through `cat` to see if it does different things when outputting to the terminal vs piping.
The biggest changes are typically ANSI color codes and column length. Some programs do strange things, like changing how they escape characters (ls).
JC turns off ANSI color codes when it’s output is not a terminal, but that’s it.
- laumars 5y agoChanges in column length isn’t something that can’t be helped. The issue is that when a command outputs to a TTY, you can use that file descriptor to get the width of the TTY (ie your terminal emulator). But if you are piping a command then it’s STDOUT is no longer a TTY and thus you have no idea how wide the terminal is.