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
Techlive Zheng edited this page Jan 5, 2014
·
3 revisions
Shell scripting is very flexible, some basic coding standards should be followed.
Variable naming convention
Environmental variable name should be in upper case, any other variable name
should all be in lower case. Global variable name should be prefixed with
__ (eg, $__file), but local variable name should not have any prefix.
Function naming convention
Function name should be prefixed with _ (eg, _current_path) in lower case.
Using $(..) instead of \..`` for command substitution
Double quote any command parameter
Keep if statement as follow
if ...
then
...
elif ...
then
...
else
...
fi
Do not write if and then in the same line
Use extended test [[]] instead of [] as much as possible