lee-pai-long
9/8/2017 - 7:43 AM

Bash simple help function

# Print current script header documentation.
#
# Header lines must start with '##'.
# WARNING: Don't use ## anywhere else or it will be catched too.
function help {
    sed -n '/^##/,/^$/s/^## \{0,1\}//p' "$self"
    exit 2
} 2> /dev/null