Re:Some advanced bash scripting
by cosmie on Friday November 11, 2016 @11:23AM
(#12932045)
The first example has a lot more use cases than it alludes to. I have a lot of aliased utility scripts for text processing, and frequently need to use them over entire files as well as on output piped from other processes. In this case, I don't know if the input file is going to be an argument or stdin from some upstream operation. That's easily taken care of with
Which sets the input to the first argument if there is one, or stdin if there isn't. My solution was a lot messier before I learned about parameter substitution.
[ Parent
| on HN ]
There are no comments on this comment yet.