Bash with Text Box & getopts

#1

Reference the following to get you going on non-interactive and report generating scripts.

#!/bin/bash

usage() { echo "Usage: $0 [-jv] [-e <exclude pattern>]" 1>&2; exit 1; }
textbox() { 
    echo
    i=0; 
    max=$(tput cols); 
    while [ $i -lt $max ]; do printf \#; i=$(($i+1)); done
    printf "\n#"
    i=0;
    while [ $i -lt $(($max-2)) ]; do printf " "; i=$(($i+1)); done
    printf "#\n#"
    splitmax=$((($max-2-${#1})/2))
    i=0;
    while [ $i -lt $splitmax ]; do printf " "; i=$(($i+1)); done
    printf "$*"
    i=0
    while [ $i -lt $splitmax ]; do printf " "; i=$(($i+1)); done
    if [ $((2+2*$splitmax+${#1})) -lt $max ]; then printf " "; fi
    printf "#\n#"
    i=0;
    while [ $i -lt $(($max-2)) ]; do printf ' '; i=$(($i+1)); done
    printf "#\n"
    i=0;
    while [ $i -lt $max ]; do printf \#; i=$(($i+1)); done
    echo
    echo
}

load=1

while getopts ":e:l:jv" o; do
    case "${o}" in
        e)  # Exclude string
            exclude=1
            excludestring=${OPTARG}
            # example exclude string 'compute-28\|compute-30\|\-\-\-\-\-\-'
            ;;
        j) 
            showjobs=1
            ;;
        l)  
            load=${OPTARG}
            echo load not used
            ;;
        v)
            verbose=1
            ;;
        *) usage
            ;;
    esac
done

shift $((OPTIND-1))

banner="DATE"
textbox "$banner"
date