Thursday, 22 August 2013

if else statment is failing in shell script

if else statment is failing in shell script

I have a very simple shell script which is failing at if-else. And I am
not able to understand what is wrong. I checked my syntax and indentation.
echo_usr()
{
read -p "Do you want to preserve $EIP_HOME/conf and
$EIP_HOME/installer/.datastore? [Y/N] " usr_in
kill_java()
if [ "$usr_in" == "y*" ] || [ "$usr_in" == "Y*" ]; then
preserve_conf()
else
if [ "$usr_in" == "n*" ] || [ "$usr_in" == "N*" ]; then
reset_home_eip()
else
echo "Invalid input"
fi
fi
reset_db()
}
It is giving me the following error: syntax error near unexpected token
`else' Any help is appreciated. Thanks!

No comments:

Post a Comment