Corrected typos and added part of the menu

master
Matt Theissen 4 years ago
parent 484f1e0a47
commit 1cae47d9f8

@ -5,7 +5,7 @@
bal="43.00" bal="43.00"
## SSH Config ## SSH Config
ssh_user="theissenm" ssh_user="theissenm"
ssh_host="knd-db01.kniod.corp ssh_host="knd-db01.kniod.corp"
@ -13,12 +13,12 @@ ssh_host="knd-db01.kniod.corp
new_account() { new_account() {
read -p "Enter the name of your account: " user1 read -p "Enter the name of your account: " user1
echo "Your account name will be $user1." echo "Your account name will be $user1."
read -p "Is that correct? [y/N]" yn read -p "Is that correct? [y/N] " yn
case $yn in case $yn in
# If user selects yes. Insert their username and a timestamp into the database. # If user selects yes. Insert their username and a timestamp into the database.
[Yy]* ) ssh $ssh_user$ssh_host "psql -U ddbank -d ddbank -c \"insert into account (username,timestamp) values ('$user1','now');\"" 2>/dev/null || echo "Username already taken."; [Yy]* ) ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"insert into account (username,timestamp) values ('$user1','now');\"" 2>/dev/null || echo "Username already taken.";
# Sets the user's id as the variable. # Sets the user's id as the variable.
user1_id=$(ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"select id from account where username='$user1';\"" | awk 'FNR == 3 {print}') user1_id=$(ssh $ssh_user@$ssh_host "psql -U ddbank -d ddbank -c \"select id from account where username='$user1';\"" | awk 'FNR == 3 {print}')
@ -48,11 +48,11 @@ new_account() {
# Menu # Menu
echo "This is the first option." echo "1) Create new user account."
echo "This is the second" echo "2) List user accounts."
echo "This is the third" echo "3) List user(s) balance."
echo " " echo " "
read -p "What is your option?: " i read -p "Select from the menu above: " i
if [ $i == 1 ] if [ $i == 1 ]
then then
new_account new_account