diff --git a/bank b/bank index 7d743a1..5580aad 100755 --- a/bank +++ b/bank @@ -112,7 +112,8 @@ get_name() { } create_account() { - read -p "Enter Account Name: " name + read -p "Enter Account Name ('c' to cancel): " name + ([ "$name" == "c" ] || [ "$name" == "c" ]) && return tstamp=$(date +%Y-%m-%d\ %H:%M:%S) read -p "Creating account: '${name}'. Are you sure? (y/N)" -n1 CONFIRM case $CONFIRM in @@ -132,7 +133,8 @@ create_account() { disable_account() { eval "$dbconnect -c \"SELECT id,name,created FROM account WHERE enabled = true ORDER BY name;\"" - read -p "Enter Account ID: " ID + read -p "Enter Account ID ('c' to cancel): " ID + ([ "$ID" == "c" ] || [ "$ID" == "c" ]) && return read -p "$(tput bold)$(tput setaf 3)DISABLING$(tput sgr0) account #${ID}: $(get_name $ID bold). Are you sure? (y/N)" -n1 CONFIRM case $CONFIRM in [Yy]) @@ -151,7 +153,8 @@ disable_account() { enable_account() { echo "DISABLED Accounts:" eval "$dbconnect -c \"SELECT id,name,created FROM account WHERE enabled = false ORDER BY name;\"" - read -p "Enter Account ID: " ID + read -p "Enter Account ID ('c' to cancel): " ID + ([ "$ID" == "c" ] || [ "$ID" == "c" ]) && return read -p "$(tput bold)Enabling$(tput sgr0) account #${ID}: $(get_name $ID bold). Are you sure? (y/N)" -n1 CONFIRM case $CONFIRM in [Yy]) @@ -169,7 +172,8 @@ enable_account() { make_deposit() { eval "$dbconnect -c \"SELECT id,name FROM account WHERE enabled = true ORDER BY name;\"" - read -p "Enter Account ID: " ID + read -p "Enter Account ID ('c' to cancel): " ID + ([ "$ID" == "c" ] || [ "$ID" == "c" ]) && return read -p "Enter amount of gp to deposit: " amount tstamp=$(date +%Y-%m-%d\ %H:%M:%S) read -p "Depositing ${amount}gp into account #${ID}: $(get_name $ID bold). Are you sure? (y/N)" -n1 CONFIRM @@ -192,7 +196,8 @@ make_deposit() { make_withdrawal() { eval "$dbconnect -c \"SELECT account.id,account.name,gold FROM balance INNER JOIN account ON account.id = balance.id WHERE account.enabled = true ORDER BY name;\"" #Show balances first - read -p "Enter Account ID: " ID + read -p "Enter Account ID ('c' to cancel): " ID + ([ "$ID" == "c" ] || [ "$ID" == "c" ]) && return read -p "Enter amount of gp to withdraw: " amount tstamp=$(date +%Y-%m-%d\ %H:%M:%S) read -p "Withdrawing ${amount}gp from account #${ID}: $(get_name $ID bold). Are you sure? (y/N)" -n1 CONFIRM