5 ms·
Sounds like an opportunity to save it in a file! My $HOME/bin is full of shell scripts containing this sort of stuff so I can avoid retyping them.
by jmts 10y ago
Sounds like an opportunity to save it in a file! My $HOME/bin is full of shell scripts containing this sort of stuff so I can avoid retyping them.
- vram22 10y agoYes, that approach is normal automation and also part of the Unix philosophy. And of course you can pass command-line arguments to the scripts too. A useful fact that I've seen some people didn't know: Unix metacharacters such as star and question mark (for filename matching, $ (in various uses such as $ star, $#, $!, etc.) - are all expanded by the shell, not by individual commands, so use of metacharacters is actually available to all commands and scripts that are run at the shell prompt - not just to selected or built-in ones. Contrast that with DOS (at least in earlier versions) which had the problem that some commands supported wild-card characters such as for filename matching, but others did not. You could write your own logic for that using OS API calls (Int 21H etc., IIRC), or calls named like FindFirst and FindNext)but it was not built-in and freely available. Edited for formatting.