LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-05-2008, 09:06 AM   #1
tugce_zehra
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Rep: Reputation: 0
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 ?

Last edited by tugce_zehra; 12-05-2008 at 09:10 AM.
 
Old 12-05-2008, 09:25 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
You have to use spaces:
Code:
if [ $command == "create_table" ]
the correct syntax is
Code:
if<space>[<space>expression<space>]
 
Old 12-05-2008, 09:59 AM   #3
tugce_zehra
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash, syntax error santana Linux - Software 2 01-23-2008 01:39 PM
Bash script syntax error snowman81 Programming 5 11-16-2007 02:35 AM
bash-3.1 bug or syntax error? moszern Linux - Software 1 06-12-2006 12:57 PM
BASH : syntax error semaja2 Programming 6 01-26-2006 12:33 AM
Bash For Loops gives syntax error meadensi Linux - Newbie 2 02-23-2005 10:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration