unix:shell-script

## Shell Script Help Function

#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
###   my-script <input> <output>
###
### Options:
###   <input>   Input file to read.
###   <output>  Output file to write. Use '-' for stdout.
###   -h        Show this message.

help() {
	
  awk -F'### ' '/^###/ { print $2 }' "$0"

}

if [[ $# == 0 ]] || [[ "$1" == "-h" ]]; then
    help
    exit 1
fi

echo Hello World
  • unix/shell-script.txt
  • Last modified: 2020-07-16T17:21:39+0200
  • by Wolfgang