unixnovice
Technical User
Hi
Can you advise me of the following :-
I have written a function to accept 2 variables, & pass them into an SQL select, as follows : -
function display_accounts_users
{
clear
print "\n\nDisplay Accounts & Users"
print -- "-------------------------"
print -n "\nPlease enter Account No. (q to quit): "
read acct_no
if [[ -z $acct_no || $acct_no = q || $acct_no = Q ]]
then
return
fi
print "\n"
print -n "\nPlease enter User ID (q to quit): "
read id_user
if [[ -z $id_user || $id_user = q || $id_user = Q ]]
then
return
fi
isql -Ubluat -Ppassword -S$AR_ENV_SYB_SERV_NAME << !
select acct_no, id_user from t_user
where id_user = "$id_user"
and id_acct = "$acct_no"
go
!
}
I wish to enhance the function to allow the user to prompt for the User ID (read id_user)
a 2nd & subsequent time, performing the SQL, until "q" is entered, when my function will end.
I am relatively new to UNIX, and cannot find entries in our reference books to describe how this might be achieved.
I know I could do a
while read x
do
etc etc
done < filename
but how do I get all my “read id_user”s, excluding the q, into filename ?
Hope you can help.
Best Wishes
Can you advise me of the following :-
I have written a function to accept 2 variables, & pass them into an SQL select, as follows : -
function display_accounts_users
{
clear
print "\n\nDisplay Accounts & Users"
print -- "-------------------------"
print -n "\nPlease enter Account No. (q to quit): "
read acct_no
if [[ -z $acct_no || $acct_no = q || $acct_no = Q ]]
then
return
fi
print "\n"
print -n "\nPlease enter User ID (q to quit): "
read id_user
if [[ -z $id_user || $id_user = q || $id_user = Q ]]
then
return
fi
isql -Ubluat -Ppassword -S$AR_ENV_SYB_SERV_NAME << !
select acct_no, id_user from t_user
where id_user = "$id_user"
and id_acct = "$acct_no"
go
!
}
I wish to enhance the function to allow the user to prompt for the User ID (read id_user)
a 2nd & subsequent time, performing the SQL, until "q" is entered, when my function will end.
I am relatively new to UNIX, and cannot find entries in our reference books to describe how this might be achieved.
I know I could do a
while read x
do
etc etc
done < filename
but how do I get all my “read id_user”s, excluding the q, into filename ?
Hope you can help.
Best Wishes