Blueno_Termux/myTermux/helper/switchcase.sh
2022-04-01 08:36:29 -04:00

31 lines
432 B
Bash
Executable File

#!/usr/bin/env bash
function switchCase() {
setCursor on
read -p " ${1} ${2}? [Y/n] " SWITCH_CASE
case "$SWITCH_CASE" in
"" )
${3}
;;
y|Y )
${3}
;;
n|N )
stat "ERROR" "Warning" "${COLOR_DANGER}Abort.${COLOR_BASED}"
exit 1
;;
* )
stat "ERROR" "Warning" "Unknown '${COLOR_DANGER}${SWITCH_CASE}${COLOR_BASED}'"
switchCase ${1} ${2} ${3}
;;
esac
}