Re: syntax error near unexpected token `then'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09:57 10 Nov 2003, Stuart Stephen <stuart.stephen@xxxxxxxxxxx> wrote:
| I have the following script in a file, which as far as I can see complies to
| the help in the OS. ('$ help if'). However, when I try to run the script it
| does not work?
| 
| Instead I get the following errors at runtime.
| 
| /root/scripts/proj.install: line 48: syntax error near unexpected token
| `then'
| /root/scripts/proj.install: line 48: `  if[ "$?" == 1 ]; then '
| 
| I don't understand what is wrong with it, from what I can tell the only
| thing I can do is make it an exclusive if statement and therefore I couldn't
| have an else or elif in the function? I'm confused to why it would not work?
| Please could someone enlighten me of where i'm going wrong?
| 
| Thanks,
| Stuart Stephen
| 
| ...blah...
| cont
| ...blah...
| 
| cont() {
|   /root/scripts/continue
|   if[ "$?" == 1 ];

You need a space around all the tokens in the test statement:

	if [ "$?" == 1 ];

Also, you want "=", not "==".

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Criminals (especially tyrants) prefer unarmed victims.
        - robertsw@xxxxxxxx (Wallace Roberts)


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux