4 ms·
Another I've run into: If you meant to search in ∗, but somehow completely forgot to type the ∗ at the end of the command line, you might do something like
by schoen 6y ago
Another I've run into:
If you meant to search in ∗, but somehow completely forgot to type the ∗ at the end of the command line, you might do something like
grep foo
and then wait for a while while grep searches your standard input, instead of files on disk, until you notice your mistake.
(I don't find this conceptually confusing -- I expect many Unix tools, including grep, to act on their standard input -- but I've still sometimes simply forgotten the * and not noticed right away.)
- axaxs 6y agoDon't feel bad, I've done this probably a thousand times. Probably because I normally am using -r which doesn't have that behavior. I usually wonder 'wow this directory was bigger than I thought' until realizing my mistake. In the modern SSD era at least, you don't waste -minutes-, usually.
- unhammer 6y agoWith (g)awk it can be even worse. $ awk 'BEGIN{while(getline<"phonebook")p[$1]=$2} $1 in p{print $0,p[$1]}' names.tsv If the file `phonebook` doesn't exist, this will just sit there politely waiting for you to create the file in your other terminal. (And then when you do, it could crash with `fatal: cannot open file `names.tsv' for reading (No such file or directory)` if that file also doesn't exist. Consistency yay.)
- nieve 6y agoTo add to the confusion grep -r without a path will recursively search the . directory.