Use Long Options in Scripts
matklad.github.io
Use Long Options in Scripts
1–10 of 157 posts
Re: Use Long Options in Scripts
#2Related 2013/2020
https://news.ycombinator.com/item?id=24518682
Re: Use Long Options in Scripts
#3And put them on separate lines so you can track and git blame them more easily.
Re: Use Long Options in Scripts
#4And put them on separate lines so you can track and git blame them more easily.
Same line git blame is not that hard, just list commits affecting specific file or even specific line span: https://git-scm.com/docs/git-log#Documentation/git-log.txt--...
Re: Use Long Options in Scripts
#5I agree with this practice. Another benefit is it makes it easier (slightly, but still) to grep the man page for what the options do.
The corollary must be "write programs that take long options".
Re: Use Long Options in Scripts
#6Please DO NOT mix string interpolation and command execution, especially when a command is processed through the shell. Whatever your language, use a list-based or array-based execution API that passes arguments straight through to execv(2), execvp(2), etc, bypassing the shell.
Re: Use Long Options in Scripts
#7This is one of my default rules for writing scripts. If the long option is available, use it. It makes too much sense to do so.
Re: Use Long Options in Scripts
#8Please DO NOT mix string interpolation and command execution, especially when a command is processed through the shell. Whatever your language, use a list-based or array-based execution API that passes arguments straight through to execv(2), execvp(2), etc, bypassing the shell.
SQL injection on steroids.
Re: Use Long Options in Scripts
#9Unfortunately, if you want your scripts to be portable to other POSIX systems you might have to use the short options, as the long ones are not standardized. You have to decide the tradeoff for yourself.
Re: Use Long Options in Scripts
#10Unfortunately, if you want your scripts to be portable to other POSIX systems you might have to use the short options, as the long ones are not standardized. You have to decide the tradeoff for yourself.
What POSIX systems in actual use (not historical Unixes) don't have the long options? macOS' BSD utilities I guess?