如何正确使用if其他条件来纠正错误


#!/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

我收到错误"语法错误:"然后"意外(期望"fi"(" 谁能给我建议答案?

否则之后不应该有条件。

你应该有

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

或使用 ELIF

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

最新更新