save_screen() { if [ -x $(type -P tput) ] then tput smcup fi } restore_screen() { if [ -x $(type -P tput) ] then tput rmcup fi } clearconfig() { local confdir [[ -z ${CONFIG} ]] && die "No \$CONFIG given!" confdir="$(dirname ${CONFIG})" if [[ ! -d ${confdir} ]] then install -d ${confdir} || die fi : > ${CONFIG} } addconfig() { local confdir local opts [[ -z ${CONFIG} ]] && die "No \$CONFIG given!" confdir="$(dirname ${CONFIG})" if [[ ! -d ${confdir} ]] then install -d ${confdir} || die fi # check for opts case $1 in -n) shift; opts=" -n" ;; -e) shift; opts=" -e" ;; esac echo ${opts} "$@" >> ${CONFIG} || die }