LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2006, 04:02 AM   #1
josedias
LQ Newbie
 
Registered: Sep 2006
Posts: 6

Rep: Reputation: 0
Unhappy syntax error near unexpected token `else'


Hi i think this is a stupip question too. But I hope than any one can help me to solve it .
./rootb.txt: line 12: syntax error near unexpected token `else
./rootb.txt: line 12: `else


#! /bin/bash
mkdir /backup_sistem/sistem

A="`date | cut -d" " -f3`"
if [ "$A" == " " ] ;
than
date | cut -d" " -f1,2,4,7 > /backup_sistem/.data
B="`cut -c1,2,3,5,6,7,9,11,12,13,14 /backup_sistem/.data`"
cp -rf /home/* /backup_sistem/sistem/
cd /backup_sistem/
tar -cvf "`echo $B.tar`" /backup_sistem/sistem/* &> /dev/null
else
date | cut -d" " -f1,2,3,6 > /backup_sistem/.data
B="`cut -c1,2,3,5,6,7,9,10,12,13,14,15 /backup_sistem/.data`"
cp -rf /home/* /backup_sistem/sistem/
cd /backup_sistem/
tar -cvf "`echo $B.tar`" /backup_sistem/sistem/* &> /dev/null
fi
rm -rf /backup_sistem/sistem
exit




best regards
jose
 
Old 09-11-2006, 04:07 AM   #2
zulfilee
Member
 
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Its 'then' not 'than' after 'if' .

Also when you face a problem in script run it with a '-x' argument.You will come close to the problem.

Ex:

sh -x one.sh
 
Old 09-11-2006, 06:30 PM   #3
josedias
LQ Newbie
 
Registered: Sep 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Thankz very much zulfilee.
with ur help I had solve the problem.

regards

jose
 
Old 09-11-2006, 07:09 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And if you tried to use actual English more (like in spelling and proper grammar)
you may run into less problems coding, too.


;)



Cheers,
Tink
 
  


Reply



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
syntax error near unexpected token `fi' Warmduvet Programming 21 10-08-2013 10:28 AM
error: unexpected token `newline' CarlosV Programming 4 05-17-2011 03:47 AM
Trouble with Bash -- syntax error near unexpected token `fi' anamericanjoe Programming 5 05-19-2006 02:59 PM
syntax error near unexpected token ` mattyspatty Programming 8 05-07-2006 05:19 PM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 06:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 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
Open Source Consulting | Domain Registration