An shell script idiom for choosing what file to operate onThis is one of those Bourne shell idioms where I show the code first and explain the effect later:
Call this
The
These three choices turn out to be pretty much what you want in practice. You don't have to give any arguments if you want to scan today's logs, while you still have the option of feeding it stuff to digest. The magic is ' (Disclaimer: while you can use this trick on standard output to have your script behave differently when it's in a pipe or otherwise having its standard output redirected, you probably don't want to do that. People get twitchy when commands produce different output like that, in part because it makes it harder to build up shell scripts bit by bit.) |
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |