Non-trivial command-line fu | Follow @rtfmsh |
ls | wc -l
— -sh (@rtfmsh) February 8, 2013
Wait, what? I thought you said Non-trivial? What the hell, man?
Precisely. This tweet is an example of what this account is not about. I've grown tired of seeing very simple commands like these posted as examples of "command line magic", and I am even more tired when I see variations like these:
ls -1 | wc -l #devops #sysadmin
Here's why:
/* Terminal defaults to -Cq, non-terminal defaults to -1. */
if (isatty(STDOUT_FILENO)) {
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 &&
win.ws_col > 0)
termwidth = win.ws_col;
f_column = f_nonprint = 1;
} else
f_singlecol = 1;
And so we will post more interesting commands in the future.
2013-02-07