Reputation: 2339
Here's my code to display some dialogs.
#!/bin/bash
output=$(zenity --list --text="Choose action" --column= --hide-header "Hidden Files" "Desktop")
if [ $output = "Hidden Files"]
then
output2=$(zenity --list --text="Do what?" --column= --hide-header "Show" "Hide")
if [ $output2 = "Show"]
then
echo showing files
else
echo hiding files
elif [ $output = "Desktop"];then
output3=$(zenity --list --text="Do what?" --column= --hide-header "Show" "Hide")
if [ $output2 = "Show"]
then
echo showing files
else
echo hiding files
else
exit
fi
I get this error after the first dialog:
systool.sh: line 12: syntax error near unexpected token `elif'
systool.sh: line 12: `elif [ $output = "Desktop"];then'
Whats wrong?
Upvotes: 0
Views: 7144
Reputation: 274632
You need to close both of your inner if-else statements with a fi
.
For example:
if [ $output2 = "Show"]
then
echo showing files
else
echo hiding files
fi
You also need a space before the closing ]
in your if conditions. For example:
if [ $output2 = "Show" ]
Upvotes: 4