diff --git a/ddbank.sh b/ddbank.sh index f738855..f207ac4 100755 --- a/ddbank.sh +++ b/ddbank.sh @@ -11,6 +11,7 @@ ssh_host="knd-db01.kniod.corp" # Functions new_account() { + clear read -p "Enter the name of your account: " user1 echo "" echo "Your account name will be $user1." @@ -52,22 +53,33 @@ list_user() { list_balance() { # Bal Menu clear - echo "1) List all users balances." - echo "2) List a specific user's balance." - echo "" - read -n1 -p "Select from the menu above: " ii - echo "" + while true + do + echo "1) List all users balances." + echo "2) User Search" + echo "3) Go back." + echo "" + read -n1 -p "*Balance Menu: Select from the above: " ii + echo "" - case $ii in - 1 ) ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"select id,username from account join balance using (id);\"" ;; - 2 ) read -p "Enter the user account name: " bal_user - bal_user1=$(ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"select id,username,balance from account join balance using (id);\"") - echo "$bal_user1" | awk 'FNR == 1 {print}' - echo "$bal_user1" | grep "$bal_user" ;; - esac + case $ii in + 1 ) ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"select id,username,balance from account join balance using (id);\"" ;; + 2 ) read -p "Enter the user account name: " bal_user + bal_user1=$(ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"select id,username,balance from account join balance using (id);\"") + echo "$bal_user1" | awk 'FNR == 1 {print}' + echo "$bal_user1" | grep -iE "$bal_user" + echo "" ;; + 3 ) break ;; + esac + done } -while true +dwt_menu() { + echo "sub-menu goes here" + +} + +while true do # Menu echo "" @@ -75,6 +87,7 @@ do echo "1) Create new user account." echo "2) List user accounts." echo "3) List user(s) balance." + echo "4) Deposit, withdraw, transfer" echo "9) Clear contents of screen" echo "0) Exit" echo "" @@ -84,7 +97,7 @@ do 2 ) list_user ;; 3 ) list_balance ;; 9 ) clear ;; - 0 ) exit + 0 ) break esac done