Member-only story

Shell Encoding Specification

Beck Moulton
9 min readOct 11, 2024

--

File header or function header:

1. The beginning of each file is a description of its file content.

Top level annotation

#!/bin/bash
#
# Perform hot backups of Oracle databases.

2. Any function that is not both obvious and short must be annotated. Any library function, regardless of its length and complexity, must be annotated.

Others can learn how to use your program or library functions without reading code by reading comments (and help information, if available).

*All function comments should include:

*Function description

*The use and modification of global variables

*Explanation of Parameters Used

*Return value instead of the default exit state after the previous command is executed

Function header annotation

#!/bin/bash
#
# Perform hot backups of Oracle databases.
export PATH='/usr/xpg4/bin:/usr/bin:/opt/csw/bin:/opt/goog/bin'
#######################################
# Cleanup files from the backup dir
# Globals:
# BACKUP_DIR
# ORACLE_SID
# Arguments:
# None
# Returns:
# None
#######################################
cleanup() {
...
}

Indent:

Shell indentation is two spaces without tabs. (Do not use tabs)

Please use blank lines between code blocks to improve readability. Indent to Two spaces

--

--

Beck Moulton
Beck Moulton

Written by Beck Moulton

Focus on the back-end field, do actual combat technology sharing Buy me a Coffee if You Appreciate My Hard Work https://www.buymeacoffee.com/BeckMoulton

No responses yet