Fair enough, and I guess it gets messy trying to remember all of the odd exceptions. Niklas Den fre 4 dec. 2020 kl 14:23 skrev Tyler Adams : > Not always > > $ cat a | while read line; do echo $line; done > #!/usr/bin/env bash > > PUPPETEER_PRODUCT=firefox npm install -g md-to-pdf > > $ < a while read line; do echo $line; done > -bash: syntax error near unexpected token `do' > > > Tyler > > > On Fri, Dec 4, 2020 at 3:17 PM Niklas Karlsson > wrote: > >> < file grep foo works. >> >> Niklas >> >> Den fre 4 dec. 2020 kl 14:16 skrev Tyler Adams : >> >>> I find cat file | grep foo simpler because it reads Left to Right. >>> >>> Tyler >>> >>> >>> On Fri, Dec 4, 2020 at 1:34 PM Andy Kosela >>> wrote: >>> >>>> On 12/4/20, arnold@skeeve.com wrote: >>>> > Dan Cross wrote: >>>> > >>>> >> This has always struck me as particularly elegant in scripts. >>>> Consider: >>>> >> >>>> >> cat "$@" | whatever >>>> >> >>>> >> (Or you may prefer `cat $* | whatever`) >>>> >> >>>> >> Now one's script can take any number of file arguments or stdin, >>>> even if >>>> >> the filter does not. >>>> > >>>> > I think Dan has hit the heart of the matter. People are used to using >>>> > cat for multiple files to start pumping data down a pipeline, so they >>>> > continue to do so even when there's only one file. >>>> > >>>> >>>> The classic example is: >>>> >>>> $ cat file | grep foo >>>> >>>> instead of the simpler: >>>> >>>> $ grep foo file >>>> >>>> It appears cat(1) and pipe(7) are deeply ingrained in people's brains. >>>> >>>> --Andy >>>> >>>