Skip to content

Latest commit

 

History

History
43 lines (37 loc) · 1.18 KB

bash.md

File metadata and controls

43 lines (37 loc) · 1.18 KB

Default script header

BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BRIGHT=$(tput bold)
NORMAL=$(tput sgr0)
BLINK=$(tput blink)
REVERSE=$(tput smso)
UNDERLINE=$(tput smul)

# Gets the correct directory even if sourcing / called from another script
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";

if [[ -z "$1" || "$1" == "-h" ]]; then
    printf -- "HELP MESSAGE\n"
    printf "${RED}%s${NORMAL}\n" "RED HELP MESSAGE"
    exit -1
fi

Redirect output while running

stdbuf -oL command > output

Gotchas

Resources