通过shell脚本将输入值传递给过程

时间:2017-04-19 03:17:14

标签: oracle shell stored-procedures

我在shell脚本中有以下用户输入代码

#!/bin/sh

echo "Enter name"
read -r name
echo "Enter email Id"
read -r email
echo "Enter the gender
        choose among the following
        (1-Male
        2-Female
        3-Others)" = "$num"  
    read -r num

if [ "$num" = "1" ] 
then
echo "MALE"

elif [ "$num" = "2" ] 
then
echo "FEMALE"

elif [ "$num" = "3" ] 
then
 echo "OTHERS"

fi
echo "Do you nedd the pass book = $data_rep"
read -r data_rep
if [ "$data_rep" = "YES" ] 
then
echo "YES"
elif [ "$data_rep" = "NO" ]
then
echo "NO"
fi

 echo "You entered name as" "$name"
 echo "You entered Email Id as" "$email"
 echo "You chose gender  as" "$num"
 echo "You chose answer for passbook as" "$data_rep"

我想将上述用户输入添加到过程中 该过程也具有相同的参数。 如何将用户输入的值传递给过程?

1 个答案:

答案 0 :(得分:0)

sqlplus $UID@$SID <<!
$PWD

exec procedure_name('$name','$email','$num');

!

其中UID - 您的用户名,SID - 您的Oracle tnsname,PWD - 密码