mardi 19 septembre 2017

Does multiple read command in conditional loop creates issue in shell script

I have one program which goes like :

fun_a() {

echo "other statement"

read user_input

if [[( $user_input == "Y" ) || ( $user_input == "y" )]];then

fun_b

else

......

fi

}

fun_b() {

echo "some other statement"

echo "any statement"

read user_inp

if [[( $user_inp == "Y" ) || ( $user_inp == "y" )]];then

do something

else

..........

fi

}

echo "any statement"

read user_inp

if [[( $user_inp == "Y" ) || ( $user_inp == "y" )]];then

fun_a

else

......

fi

I am not getting expected output from the "read" command. Is it because of the fact that none of the if block is getting closed before the next read statement has been called. If it is so Kindly suggest some solution

Aucun commentaire:

Enregistrer un commentaire