I have been adjusting to using GETOPT and GETOPTS in my shell scripts and custom functions to enable me to use the functions that I create more flexibly. After using a number of UNIX functions I have realized that a lot of them use a somewhat similar syntax.
Examples being -v for verbose output and -R/-r for recursive functionality.
I looked at the POSIX standard guide for utility conventions and the GNU's option tables for C based utilities. In an attempt to understand whether this was by design and if there are any rules that I should be following.
My questions are:
1. Are there are any specific option flags that have designated meaning?
2. How much freedom do I have with my options and which rules shouldn't I break?
3. Should I stay way from giving options like -t and -T different meanings, or should I group them together for simplicity?
4. What situations should I use uppercase or lowercase letters?
--versionand--helpfor example), AFAIK these are not universal.--helpoption was added to GNU coretutils in '93. From changelog : (for 21 commands)Add long --help. Exit successfully for --help, non-zero for usage error.