Home > Syntax Error > Syntax Error Near Unexpected Token Then' In Shell Script

Syntax Error Near Unexpected Token Then' In Shell Script

Contents

share|improve this answer answered Apr 10 at 7:47 Julian 1,036410 add a comment| Not the answer you're looking for? more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed The reason for space before the ] is similar. more hot questions question feed about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Science Source

Working now. –Bill Sherwin Mar 24 '10 at 15:39 add a comment| up vote 2 down vote Here's a very handy alternative. Complimenting the author of a textbook Does using documentation as a developer make me look unprofessional? Reload to refresh your session. Now fixed in rbenv/[email protected]

Syntax Error Near Unexpected Token Then' In Shell Script

By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. The reason for the ; or linebreak is that the condition part of the if statement is just a command. For ksh scripts to run on all *nixes, they usually start: #!/usr/bin/env ksh jschiwal View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by How should I tell my employer?

Search this Thread 02-16-2010, 02:04 PM #1 snakernetb LQ Newbie Registered: Dec 2004 Location: Bloomington, IL Distribution: FC3 Posts: 5 Rep: syntax error near unexpected token `then' Hi all, share|improve this answer edited Mar 20 at 19:38 answered Mar 20 at 18:26 Archemar 12.7k82149 I didn't even get to $editor "file name" –Scripty Coder Mar 20 at 19:16 Because otherwise it will not be recognized as a parameter of its own. Syntax Error Near Unexpected Token (' Bash Here is my script: uname=`uname` os1="AIX" os2="SunOS" os3="Linux" #echo $oslevel if [[ $uname = $os1 ]] then /tools/HourlyProcess/HourlyProcess_Kickoff_AIX fi if [[ $uname = $os2 ]] then /tools/HourlyProcess/HourlyProcess_Kickoff_Sun fi if [[ $uname

Browse other questions tagged bash shell shell-scripting or ask your own question. It just did not solve all the problems in the question. –lesmana Aug 22 '13 at 12:39 if is syntax, it isn't an ordinary command. The Gnu man page doesn't even mention that. 44 CURDUPLEX=`ethtool $IFACE|grep "Duplex" ...` 45 CURSPEED=`ethtool $IFACE|grep "Speed" ...` Calling ethtool twice gives Nagios performance a bad name. Terms Privacy Security Status Help You can't perform that action at this time.

What are the downsides to multi-classing? Syntax Error Near Unexpected Token `elif' Need a way for Earth not to detect an extrasolar civilization that has radio Why is the Vitamin B complex, a "complex"? Not the answer you're looking for? The shell executes the command [ with the rest as parameters, including the ] as mandatory last parameter.

Syntax Error Near Unexpected Token Then' In Unix

Thanks for all the work on rbenv proper!‚Äč Sign up for free to join this conversation on GitHub. if [ $weight1 -gt $weight2 ]; then echo "Weight 2 should be greater than Weight 1." else if [ $weight1 -ge 20 ] && [ $weight1 -le 39 ]; then echo Syntax Error Near Unexpected Token Then' In Shell Script Why are terminal consoles still used? Syntax Error Near Unexpected Token `exit' Is there a performance difference in the 2 temp table initializations?

working now. this contact form Join them; it only takes a minute: Sign up Syntax error near unexpected token 'then' up vote 15 down vote favorite 1 I typed the code the same as The Linux We recommend upgrading to the latest Safari, Google Chrome, or Firefox. You don't want to assume that the 'default' shell will always be ksh (or whatever). Syntax Error Near Unexpected Token In Shell Script

Unix & Linux Stack Exchange works best with JavaScript enabled current community blog chat Server Fault Meta Server Fault your communities Sign up or log in to customize your list. Hit a curb today, taking a chunk out of the tire and some damage to the rim. Am I being a "mean" instructor, denying an extension on a take home exam Help my maniacal wife decorate our christmas tree How to decrypt .lock files from ransomeware on Windows http://netlookmag.com/syntax-error/syntax-error-near-unexpected-token-shell-script.html more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed

So, = is needed in place of -eq. Syntax Error Near Unexpected Token `done' Is it unethical to take a photograph of my question sheets from a sit-down exam I've just finished if I am not allowed to take them home? more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed

Secret salts; why do they slow down attacker more than they do me?

Is it still safe to drive? Alternatives: if [[ $? -ne 0 ]];then or if ! Most useful knowledge from the 30's to understand current state of computers & networking? [: Too Many Arguments The reason for the spaces after [ is because [ is also not syntax.

So that the script works even if the user enters nothing, $answer is placed inside double-quotes in the tests. Joining two lists with relational operators Unable to understand the details of step-down voltage regulator Why does Snoke not cover his face? My system is Ubuntu. Check This Out Will majority of population dismiss a video of fight between two supernatural beings?

There must be a space between [[ and first operator. I have various flavors of Linux. Related 3004Getting the Current/Present working directory of a Bash script from within the script0Syntax error near unexpected token “elif” in bash1syntax error near unexpected token `if'10BASH Syntax error near unexpected token Take a look at mywiki.wooledge.org/BashPitfalls in general, and, say, #4 in particular. –cjc Jul 27 '12 at 21:07 add a comment| 2 Answers 2 active oldest votes up vote 0 down

mislav commented Oct 11, 2015 Workaround in 362b570 Collaborator jasonkarns commented Oct 12, 2015 Thanks. Is an internal HDD with Ubuntu automatically bootable from an external USB case? Should a country name in a country selection list be the country's local name? Also, a space is required between echo and "please enter correct input.".

I ran into this error and i'm having trouble solving it. [[email protected] ~]$ ./account-manager user add ./account-manager: line 21: syntax error near unexpected token `then' ./account-manager: line 21: ` then' How Is including the key as AAD actually dangerous? Will majority of population dismiss a video of fight between two supernatural beings? Any command of any length to be precise.

Are you new to LinuxQuestions.org? Join them; it only takes a minute: Sign up syntax error near unexpected token `then' [duplicate] up vote 0 down vote favorite This question already has an answer here: Why should share|improve this answer answered Mar 20 at 18:13 Thomas Dickey 36.4k34495 Thank you but I found that my lower casing didn't work so it never understands the input, and Last edited by snakernetb; 02-16-2010 at 02:32 PM.

These (and their combinations) would all be incorrect too: if [-e "$FILE" ]; then if [ -e"$FILE" ]; then if [ -e "$FILE"]; then These on the other hand are all Hit a curb today, taking a chunk out of the tire and some damage to the rim. Some CentOS, RH, and even a Gentoo server. Remnants of the dual number Unable to complete a task at work.

How should I tell my employer?