|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
bal="43.00"
|
|
|
|
|
## SSH Config
|
|
|
|
|
ssh_user="theissenm"
|
|
|
|
|
ssh_host="knd-db01.kniod.corp
|
|
|
|
|
ssh_host="knd-db01.kniod.corp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,7 +18,7 @@ new_account() {
|
|
|
|
|
case $yn in
|
|
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
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
|
|
|
|
|
echo "This is the first option."
|
|
|
|
|
echo "This is the second"
|
|
|
|
|
echo "This is the third"
|
|
|
|
|
echo "1) Create new user account."
|
|
|
|
|
echo "2) List user accounts."
|
|
|
|
|
echo "3) List user(s) balance."
|
|
|
|
|
echo " "
|
|
|
|
|
read -p "What is your option?: " i
|
|
|
|
|
read -p "Select from the menu above: " i
|
|
|
|
|
if [ $i == 1 ]
|
|
|
|
|
then
|
|
|
|
|
new_account
|
|
|
|
|