pavani
pavani

Reputation: 1

How to use if else condition properly to rectify the error

#!/bin/bash
$activity1 = zenity  --list  --text " select the option" --radiolist  --column "Select" --column "you are" FALSE "admin" TRUE "customer" ;


if [ $activity1  = "admin"]; then

 ( zenity --password --username );

else [ $activity1 = "customer" ]; then


( zenity --entry );\

--entry-text ""
fi

I got an error "Syntax error: "then" unexpected (expecting "fi")" Can any one suggest me the answer?

Upvotes: 0

Views: 124

Answers (1)

Paul Floyd
Paul Floyd

Reputation: 6906

There should not be a condition after else.

You should either have

if [ $activity1  = "admin"]; then
   ( zenity --password --username );
else # no condition
   zenity --entry );\
   --entry-text ""
fi

or use elif

if [ $activity1  = "admin"]; then
   ( zenity --password --username );
elif [ $activity1 = "customer" ]; then
   ( zenity --entry );\
   --entry-text ""
fi

Upvotes: 1

Related Questions