LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   syntax error in bash (https://www.linuxquestions.org/questions/linux-newbie-8/syntax-error-in-bash-688536/)

tugce_zehra 12-05-2008 09:06 AM

syntax error in bash
 
Hi everybody;
I guess it's a very easy to solve problem but I could not find its solution.I would like to get a string from user , and I wrote this:

Code:

#!/bin/bash
#First attempt to making mission.

clear

echo "Welcome to the table manipulator script.Enter command:"

read command

if[$command == "create_table"]
        then
        echo "command received"
else
        echo "failure"
fi

I received these errors:

firstAt: line 10: if[create_table == create_table]: command not found
firstAt: line 11: syntax error near unexpected token `then'
firstAt: line 11: ` then'

I am using Fedora 4.Is there any suggestion for solution ?

colucix 12-05-2008 09:25 AM

You have to use spaces:
Code:

if [ $command == "create_table" ]
the correct syntax is
Code:

if<space>[<space>expression<space>]

tugce_zehra 12-05-2008 09:59 AM

Quote:

Originally Posted by colucix (Post 3365513)
You have to use spaces:
Code:

if [ $command == "create_table" ]
the correct syntax is
Code:

if<space>[<space>expression<space>]

Thank you very much, colucix.


All times are GMT -5. The time now is 02:23 PM.