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: 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.
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.
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$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
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
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$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