Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9045003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:08:14+00:00 2026-06-16T11:08:14+00:00

I need a little help with my bash script: #!/bin/bash zenity –list –title=Select Server

  • 0

I need a little help with my bash script:

#!/bin/bash

zenity --list --title="Select Server" --text="Select the server to start" --radiolist \
--column= --column=Server --column=Port \
FALSE "Creative+Survival" 25565 \
FALSE "Tekkit Cheat Survival" 25566 \
FALSE "Flat Tekkit" 25567 \
FALSE "SunnyDale City" 25568 \
FALSE "Doom Dungeon" 25569 \
FALSE "Survival Tekkit" 25570 \
| cat > ~/temp


server=$(cat ~/temp)

if $server="Creative+Survival" then
gnome-terminal -x sh "/home/kulboy121/Servers/Creative and Survival/launch.sh"
end

else
echo wrong answer...
end

rm ~/temp

This is a script to launch some Minecraft servers I own. I will eventually add if entries for all the other servers as well.
This is the output when I do not select Creative+Survival:

Server Startup - INCOMPLETE.sh: 20: Server Startup - INCOMPLETE.sh: Syntax error: "else" unexpected (expecting "then")

And when I do select Creative+Survival, the same thing happens. Sorry if this is a stupid question, this is one of my first bash scripts.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:08:15+00:00Added an answer on June 16, 2026 at 11:08 am

    The bracket [ (test) operator is missing. It should be something like this:

    if [ "$server" = "Creative+Survival" ]
    then
        echo "true"
    else
        echo "false"
    fi
    

    NOTE: the spaces around those brackets are important.
    The square brackets around the conditional test are actually a synonym for the test operator.
    So the above is equivalent to:

    if test "$server" = "Creative+Survival"
    then
       echo "true"
    else
       echo "false"
    fi
    

    But everyone uses the brackets; I rarely see scripts that use the test keyword.

    Also allowed in the bash shell (although this is not as portable because it is not a POSIX standard) is to use double brackets:

    if [[ "$server" = "Creative+Survival" ]]
    then
    

    Here’s a link to page that describes the differences between [, [[, and test:
    http://mywiki.wooledge.org/BashFAQ/031


    Update

    Q: This seems to work, but it spits out an error code if I select anything other then “Creative+Survival”. Is this supposed to happen?

    A: It’s not at all clear what error code is being spit out by what component. I expect you want to check for each possible selection. You can do that with an elif, or with a case.

    if [ "$server" = "Creative+Survival" ]
    then
        echo "Creative and Survival"
    elif [ "$server" = "Tekkit Cheat Survival" ]
    then
        echo "Tekkit Cheat Survival"
    elif [ "$server" = "Flat Tekkit" ]
    then
        echo "Flat Tekkit"
    else
        echo "no action for specified server"
    fi
    
    
    case "$server" in
        'Creative+Survival')
            echo "Creative and Survival"
            ;;
        'Tekkit Cheat Survival')
            echo "Tekkit Cheat Survival"
            ;;
        *)
            echo "no action found for server $server"
            ;;
    esac
    

    (NOTE: the indentation is to improve readability only; bash cares about the newlines, not the leading spaces.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a little help getting this script doing what I want it to.
I need a little help with this shell script. I have a variable, represents
Need a little help again. Say I have an unordered list, and I want
need a little help with the regexp i make... have some text where links
Need a little help with a solution for this problem. I have a list
Need a little help with this script. It's working but I'd love a way
Need a little help figuring out how to get 3 list boxes to populate
I need a little help with SELECT FOR UPDATE (resp. LOCK IN SHARE MODE
I need little help for url rewriting in wordpress. basically what i need: mydomain.com/mysomewordpresspost
I would need little help here. I'm trying to get the git respository from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.