#!/usr/bin/env bash test ! -n "${SCRIPTS}" && echo "SCRIPTS not set" && exit 1; test ! -n "${1}" && echo "usage: newscript " && exit 1; path="${SCRIPTS}/${1}" if test -e "${path}"; then read -p "${1} already exists. Edit? " yes case "${yes}" in y|yes|yep|yeppers|yeah|ok|okay) exec vim "${path}" esac exit 0 fi printf "#!/usr/bin/env bash\n\n" > "${path}" chmod +x "${path}" exec vim +2 "${path}"