Home > Syntax Error > Syntax Error Near Unexpected Token Elif' In Linux

Syntax Error Near Unexpected Token Elif' In Linux

Contents

This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. How is my code any different from these examples or these examples? But if you look more closely at the error, it is bash that is giving the error, not another shell. Anyway, to your > question of how to debug: turn on command tracing with ``set -x''. > Do this in your .profile file and/or adding ``(shell "set -x")'' > into your http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-elif-39-bash.html

lots of output deleted which seems to go well .. ] make[3]: Entering directory `/usr/src/redhat/BUILD/autogen-5.5.5/agen5' if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../autoopts -O2 -g -march=i386 -mcpu=i686 -MT autogen-defParse.o -MD -MP There is no semi-colon before the THEN statement. If I run the autogen command >>directly, it runs fine. >> >>Any idea how I debug this? >>Thanks, >> >>Ron Arts >> >>$ make >>autogen -b uw_send -Dconfdir=/etc/upwatch.d -Dsysconfdir=/etc >>-Dsbindir=/usr/sbin -Dlogdir=/var/log/upwatch Ubuntu Logo, Ubuntu and Canonical Canonical Ltd.

Syntax Error Near Unexpected Token Elif' In Linux

Difficulties interpreting this complex sentence Can a free radical be created by chemical reaction of non-radical species? druuna's advice is correct. What mechanical effects would the common cold have?

The problem in the last examples is that you forgot a space between if and [ and between elif and [. If so, is there a command to strip it? You can put several commands between if and then, so those semicolons are mandatory. Syntax Error Elif Unexpected Expecting Then I saw that.

Blogs Recent Entries Best Entries Best Blogs Blog List Search Blogs Home Forums HCL Reviews Tutorials Articles Register Search Search Forums Advanced Search Search Tags Search LQ Wiki Search Tutorials/Articles Search Syntax Error Near Unexpected Token `elif' In Unix Adv Reply March 6th, 2009 #2 ghostdog74 View Profile View Forum Posts Private Message I Ubuntu, Therefore, I Am Join Date Sep 2006 Beans 2,914 Re: Bash - syntax error Join our community today! more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation

For details and our forum data attribution, retention and privacy policy, see here UNIX & Linux Forums > Top Forums > Shell Programming and Scripting Member Name If Elif Bash You signed out in another tab or window. THINKING!!!... If you need to reset your password, click here.

Syntax Error Near Unexpected Token `elif' In Unix

Can a free radical be created by chemical reaction of non-radical species? UNIX is a registered trademark of The Open Group. Syntax Error Near Unexpected Token Elif' In Linux How should I tell my employer? Syntax Error Near Unexpected Token Fi' Shell Script Please don't fill out this field.

An electronics company produces devices that work properly 95% of the time How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? this content But something is up with the ELSE statement: Code: luc$[519]test> for i in $(ls -1a); do > if[ "$i" == '.' ] then > echo 'one dot' > elif[ "$i" == For example: if [ $output2 = "Show" ] share|improve this answer answered Dec 1 '11 at 14:03 dogbane 141k44244331 2 LOL wow i'm stupid. –t3hcakeman Dec 1 '11 at 14:07 Who is spreading the rumour that Santa isn't real? Syntax Error Near Unexpected Token Else In Shell Script

Remnants of the dual number Aligning texts side by side with equations in \align environment Why would a NES game use an undocumented 1-byte or 2-byte NOP in production? I could not find any reference to it (apart from docs) in the autogen source package, and they don't seem to do anything. Re: [Autogen-users] /bin/bash: line 6: syntax error near unexpected token `elif' From: Bruce Korb - 2003-11-06 17:27:58 The value of SHELL in make(1) is set to a shell that doesn't http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-39-in-linux.html Python tutorial |Unix power tools|Effective AWK|A handful of Awk|Perl|File Renamer|Bash ref Adv Reply March 6th, 2009 #5 Squigy Dunkens View Profile View Forum Posts Private Message 5 Cups of Ubuntu

options = "ListFiles Make/EditFile Quit" select choice in $options; do if [ "$choice" = "ListFiles" ]; then echo Would you like to list the files of the current directory, or a Syntax Error Near Unexpected Token (' Bash Is there a performance difference in the 2 temp table initializations? asked 3 months ago viewed 265 times active 3 months ago Linked 2 command not found and syntax error near unexpected token Related 0Shell script - syntax error near unexpected token

Hope this clears things up.

To put if and then on the same line you have to separate them with semi-colon, that is the same you did with for and do in the first line. Look: Code: luc$[518]test> for i in $(ls -1a); do > if[ "$i" == '.' ]; then bash: syntax error near unexpected token `then' The correct way is without the semi-colon. Yes, I googled. Syntax Error: Unexpected End Of File Eating Christmas Cookies, on my bridge?

This should work: Code: $ for i in $(ls -1a); do > if [ "$i" == '.' ]; then echo 'one dot' > elif [ "$i" == '..' ]; then echo A pilot's messages Is an internal HDD with Ubuntu automatically bootable from an external USB case? share|improve this answer answered Nov 15 '10 at 7:12 Chris Morgan 44.6k884135 OS X uses \n just like Linux and Unix (since it is a member of the family). check over here grail View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by grail 05-10-2010, 10:03 PM #10 lucmove Member Registered: Aug 2005 Location: Brazil

Training Certification Events Webinars CommunityParticipate Q&A Forums Blogs ResourcesNewsletter Distributions Publications Infographics Photos Videos Jobs deatharte October 8, 2010 syntax error near unexpected token `fi' Forums:Command Line/Scripting #!/bin/bash if [[ -e