Home > Syntax Error > Bash Case Syntax Error

Bash Case Syntax Error

Contents

Bash, dash and sh should be acceptable results. Case statement is not a loop, it doesn't execute a block of code for n number of times. Can filling up a 75 gallon water heater tank without opening a faucet cause damage? There is nothing out of the ordinary on the console and nothing in the error log. http://gatoisland.com/syntax-error/bash-for-syntax-error.php

x=`expr $1 % $3`; echo $x share|improve this answer answered Mar 31 '11 at 2:07 tianyapiaozi 3461414 I tried all of those changes and I am still receiving the Using cat -v problem02.sh(-v means to show nonprinting character) and check carefully at line 7, whether there is some output containing '^R' or '^M'. asked 5 years ago viewed 1112 times active 5 years ago Related 2103Check if a directory exists in a shell script721How do I prompt for input in a Linux shell script?389Why Bash Case Example 5.

Bash Syntax Error Near Unexpected Token Done'

Find More Posts by dive 05-06-2006, 05:55 AM #7 pasteNoctem Member Registered: Apr 2006 Location: Athens Greece Distribution: Kubuntu Posts: 35 Rep: Quote: Originally Posted by zaichik Hmm, works Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the Dennis numbers 2.0 Meaning of Guns and ghee How to handle spending money for extended trip to Europe?

If more patterns match the word, only the first match is taken. (Note the comment about Bash v4 changes above.) Multiple |-delimited patterns can be specified for a single block. up vote 22 down vote favorite 3 I'm trying to do something like this: case $level in 3) echo "Level Three" 2) echo "Level Two" 1) echo "Level one" ;; esac share|improve this answer answered Sep 29 '10 at 4:59 Dennis Williamson 167k42235305 Those would generate 'command not found' errors, not a syntax error. Bash Syntax Error Near Unexpected Token Then' I've read over many tutorials and I think I'm doing the same thing as them, but something's just not right.

If not, why? Bash Syntax Error Near Unexpected Token Else' Link KHALIQ February 8, 2015, 3:37 pm In a unix directory there are five applications and qa,init,prod when i run a start.sh it should pick up whatever env I give .can The script was working fine up until my changes today, but I really didn't touch this section, with the exception of tweaking some of the STR values. UNIX is a registered trademark of The Open Group.

asked 3 years ago viewed 8202 times active 3 years ago Related 20In a bash script, using the conditional “or” in an “if” statement1bash if statement behaviour question0Multi statement if condition Bash Syntax Error Near Unexpected Token Do' The ;;& operator is like ;;, except the case statement doesn't terminate after executing the associated list - Bash just continues testing the next pattern as though the previous pattern didn't This script has no meaning and might not even make sense, it's just a test.) linux bash syntax-error case share|improve this question edited Dec 7 '15 at 20:17 Tomasz Jakub Rup How to map and sum a list fast?

Bash Syntax Error Near Unexpected Token Else'

share|improve this answer edited Sep 29 '10 at 5:09 answered Sep 29 '10 at 4:52 Jonathan Leffler 437k61507821 Thank you. The name "Vim" is an acronym for "Vi IMproved" because Vim was created as an extended version of the vi editor, with many additional features designed to be helpful in editing Bash Syntax Error Near Unexpected Token Done' Why don't most major game engines use gifs for animated textures? Bash Syntax Error Near Unexpected Token Fi' But none of them are documented under "case" in my man bash page or my info bash. (There is documentation elsewhere for patterns in general.) .

Is 8:00 AM an unreasonable time to meet with my graduate students and post-doc? his comment is here For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. case expression in pattern1 ) statements ;; pattern2 ) statements ;; ... Follow us on Google+ Follow us on Twitter Become a fan on Facebook Support Us Support this blog by purchasing one of my ebooks. Bash Syntax Error Invalid Arithmetic Operator

Good catch though - +1 –desertwebdesigns Sep 29 '10 at 5:11 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign Browse other questions tagged linux bash shell case syntax-error or ask your own question. i found some on the web and mashed em together to create this: Code: case "$1" in start) echo "STARTING SERVER... http://gatoisland.com/syntax-error/bash-if-syntax-error.php code: Code: #!/bin/bash while : do echo "-----Menu for Camera Save Script-----" echo " Main Menu " echo "-------------------------------------" echo "[1] Save to dir: Todays date/time" echo "[2] Save files custom

How to map and sum a list fast? Bash Syntax Error Near Unexpected Token Newline' spectral norm of block-wise sums of matrices What are the holes on the sides of a computer case frame for? Is this safe to display MySQL query error in webpage if something went wrong?

Should indoor ripened tomatoes be used for sauce?

  1. Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us.
  2. I like those!' ;; banana) echo 'Hm, a bit awry, no?' ;; orange|tangerine) echo $'Eeeks!
  3. Skeletal formula for carbon with two double bonds Subtraction with a negative result Limit involving exponentials and arctangent without L'Hôpital The Woz Monitor My girlfriend has mentioned disowning her 14 y/o
  4. read -p "Enter the message position (use sign for relative position): " tMPos # Validate the reply (tMPos) and update the global message position (vMPos): # case "$tMPos" in # Positive

Problem? Password Programming This forum is for all programming questions. Yes, of course I'm an adult! Bash Syntax Error Unexpected End Of File Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started

I was trying to increment a variable in a loop with var=$(( $var + 1 )) and I was missing the + 1 )) part. the script isnt in the root DIR, and i will be executing it from ROOT/home/hlds_1 does this matter while trying to find the file? (as i checked bash DOES exist) i Try 'help' as the first argument." ;; esac Think of it as a break statement in a programming language. http://gatoisland.com/syntax-error/bash-bc-standard-in-1-syntax-error.php But it's a good point. –Lambda Ninja Oct 24 '15 at 2:13 1 As you can glean from @PSkocik's comments: the page you link to promotes bad habits (and grammar);

But if you need to write a proper for, take this into consideration. You could also try #! /path/to/bash make sure you put the leading / dive View Public Profile View LQ Blog View Review Entries View HCL Entries Visit dive's homepage! You can take it out. Give two amount find the %?\ 2.Two convert centigrade to Fahrenheit 3.

Didn't know about that one. –desertwebdesigns Sep 29 '10 at 5:10 add a comment| up vote 2 down vote You have spaces around your equal signs in this section: case $VERSION Emerson II, 2013/02/25 04:19 More information about the PATTERN would be helpful. more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation I am just learning these linux commands.

I am still making other modifications, but the case thing works now. mattyspatty View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by mattyspatty 05-05-2006, 04:41 PM #4 zaichik Member Registered: May 2004 Location: Iowa Sep 23 '13 at 15:08 add a comment| up vote 0 down vote The error is most likely occurring before this block of code. Join our community today!

© Copyright 2017 gatoisland.com. All rights reserved.