-
Notifications
You must be signed in to change notification settings - Fork 3
Guideline for aliases
linux-shell-base edited this page Oct 22, 2017
·
16 revisions
Guideline for aliases and short functions in Linux-shell-base.
- is categorized.
- has a description.
Alias and short function files are created in the following format:
alias name='alias start... ...alias end' # name: description
alias name='alias start... ...alias end' # name: description
alias name='alias start... ...alias end' # name: description
name() { function line 1 start... ...function line 1 end \
function line 2 start... ...function line 2 end; } # name: description
name() { function line 1 start... ...function line 1 end \
function line 2 start... ...function line 2 end \
function line 3 start... ...function line 3 end; } # name: description
name() { function line 1 start... ...function line 1 end \
function line 2 start... ...function line 2 end \
function line 3 start... ...function line 3 end; } # name: description
name() { function start... ...function end; } # name: description
name() { function start... ...function end; } # name: description
name() { function start... ...function end; } # name: description
- A line is a maximum width of 100 characters for aliases and 80 character for short functions (discluding the description). If the solution is longer than 100 character, it should be a short fuction.
- If the solution is longer than 3 lines, it should be changed to a script.
- The comment specifier ("#") starts on column 82. If an alias line is wider than 80 characters, the comment specifier starts one space after the end of the alias.
- A line is continued on the next line only with the last (space separated) word that exceeds the 80 character limit.
- Short functions with more than one line are separated by a blank line.
- A description is all lowercase letters (except for names and acronymns that need to be capitalized or uppercase).
For an example, see aliases-linux-output_only-multi-value.bash.
- A variable name uses acronyms whenever possible.
- A non-global variable inside a function is declared local.
All other code style rules are up to the contributor.