You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All scripts should at least have long and short options for help and version.
Help always contains Short and long description, synopsis, options descriptions.
Environment variables are always ALL_CAPS.
global variables and arrays are prefixed with __two_underscores
all other variables are declared local.
functions are all lowercase(){ : ;}
informative mandatory globals always at the top of the scripts after shebang (#!/bin/env bash)
three mandatory functions: main() and init()printinfo()
special optional global variables are __lastarg and __stdin. __lastarg is defined after options are parsed, __stdin` is defined before entering main function.
maybe add mandatory function deticated for option parsing.
options are defined like this:
__optargs[longoption]=ARGNAME
__opttext[longoption]=description
__options[longoption]= followed by optional shortoption, colons, and +.
one colon means that the option have a mandatory argument, two colons are optional argument, + will automaticly add the argument to a global variable named __LONGOPTION, if no argument is given set the variable to 1.
The text was updated successfully, but these errors were encountered:
Rules of bash:
All scripts should at least have long and short options for help and version.
Help always contains Short and long description, synopsis, options descriptions.
Environment variables are always ALL_CAPS.
global variables and arrays are prefixed with __two_underscores
all other variables are declared local.
functions are all lowercase(){ : ;}
informative mandatory globals always at the top of the scripts after shebang (
#!/bin/env bash
)three mandatory functions:
main()
andinit()
printinfo()
special optional global variables are
__lastarg
and__stdin
.__lastarg is defined after options are parsed,
__stdin` is defined before entering main function.maybe add mandatory function deticated for option parsing.
options are defined like this:
__optargs[longoption]=ARGNAME
__opttext[longoption]=description
__options[longoption]= followed by optional shortoption, colons, and +.
one colon means that the option have a mandatory argument, two colons are optional argument, + will automaticly add the argument to a global variable named __LONGOPTION, if no argument is given set the variable to 1.
The text was updated successfully, but these errors were encountered: