waspsoft.com


Home > Syntax Error > Bash Case Syntax Error

Bash Case Syntax Error

Contents

Search this Thread 05-05-2006, 04:09 PM #1 mattyspatty LQ Newbie Registered: Jun 2005 Posts: 9 Rep: syntax error near unexpected token ` /csgo: line 1: syntax error near unexpected Can filling up a 75 gallon water heater tank without opening a faucet cause damage? The patterns are checked in order until a match is found; if none is found, nothing happens. This is actually a very promising explanation. http://waspsoft.com/syntax-error/awk-switch-case-syntax-error.html

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 I do realize what I'm asking also. can u help if test $# = 3 then case $2 in /) z=$(($1/$3));; x|X) z=$(($1*$3));; +) z=$(($1+$3));; -) z=$(($1-$3));; *) echo "warning - $2 invalid operator, pls use X or Natural construction Is my workplace warning for texting my boss's private phone at night justified?

Bash Syntax Error Near Unexpected Token Done'

Not the answer you're looking for? Sorry, I'm busy." *) echo "You didn't say anything. The other special marker is ;;&, which: causes the shell to test the patterns in the next clause, if any, and execute any associated command-list on a successful match. ;; is

  • zaichik View Public Profile View LQ Blog View Review Entries View HCL Entries Visit zaichik's homepage!
  • just try re-installing the compiler/interpreter pasteNoctem View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by pasteNoctem 05-06-2006, 06:08 AM #8 zaichik Member
  • GTIN validation Activate Hearthstone season chest cards?
  • Case statement is not a loop, it doesn't execute a block of code for n number of times.
  • UNIX is a registered trademark of The Open Group.
  • If so, that's the problem. –tianyapiaozi Mar 31 '11 at 5:19 | show 3 more comments up vote 0 down vote The last case clause should be *) echo "Invalid option"
  • Good way to explain fundamental theorem of arithmetic?

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 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 I am receiving "syntax error near unexpected token `in" and "case "$y" in" #!/bin/sh echo "Variable name \$1 $1" echo "Variable name \$2 $2" echo "Variable name \$3 $3" y=$2 echo Bash Syntax Error Near Unexpected Token Then' asked 11 months ago viewed 108 times active 11 months ago Related 2882Can a Bash script tell which directory it is stored in?721How do I prompt for input in a Linux

Read more about Ramesh Natarajan and the blog. Bash Syntax Error Near Unexpected Token Else' Find File type from the Extension This example prints type of a file (text, Csource, etc) based on the extension of the filename. $ cat filetype.sh #!/bin/bash for filename in $(ls) Syntax of bash case statement. How to map and sum a list fast?

Link Chris F.A. Bash Syntax Error Near Unexpected Token Do' Follow us on Google+ Follow us on Twitter Become a fan on Facebook Support Us Support this blog by purchasing one of my ebooks. How does the pilot control the Dassault Rafale? There is nothing out of the ordinary on the console and nothing in the error log.

Bash Syntax Error Near Unexpected Token Else'

Your answers accepted! I am just learning these linux commands. Bash Syntax Error Near Unexpected Token Done' Try adding this: #!/bin/bash at the beginning, since /bin/sh didn't work. Bash Syntax Error Near Unexpected Token Fi' If you need to reset your password, click here.

How are you invoking it? weblink I redid all of the spacing and finally managed to get it to work. It can be used to test simple values like integers and characters. Yes, text is text...but there are difference bewteen *nix and Windows, especially in newlines. Bash Syntax Error Invalid Arithmetic Operator

What is the sh -c command? Is it required?1Looping through lines in file using bash and passing to variable. Should indoor ripened tomatoes be used for sauce? navigate here it says there is an unexpected parentheses at 1).

Please visit this page to clear all LQ-related cookies. Bash Syntax Error Near Unexpected Token Newline' Registration is quick, simple and absolutely free. i found some on the web and mashed em together to create this: Code: case "$1" in start) echo "STARTING SERVER...

Emerson II, 2013/02/25 04:19 More information about the PATTERN would be helpful.

Not the answer you're looking for? asked 3 years ago viewed 3098 times active 3 years ago Related 4Shell Script - syntax error near unexpected token `else'2bash: syntax error near unexpected token `}'-1Syntax error in bash script: Using ;;& in place of ;; causes the shell to test the next pattern list in the statement, if any, and execute any associated list on a successful match. Bash Syntax Error Unexpected End Of File Is the standard Canon 18-55 lens the same as 5 years ago?

Real name: E-Mail: Website: Enter your comment. share|improve this answer answered Oct 24 '15 at 2:02 Lambda Ninja 7,81982861 1 thank you for this. Try 'help' as the first argument." esac Here's the output (the filename is newmkdir and I ran it with no arguments): ./newmkdir: line 4: syntax error near unexpected token `)' ./newmkdir: his comment is here Startup script Startup scripts in the /etc/init.d directory uses the case statement to start and stop the application.

Luckily it was taken an hour long laborious task down to about 5 minutes for me :) –desertwebdesigns Sep 29 '10 at 4:57 FOUND IT!!! A comment at StackOverflow gave me the answer. But what if one wants to match a variable number of digits, for example? Is my workplace warning for texting my boss's private phone at night justified?

Add to curr value ([+]+([[:digit:]])) vMPos=$vMPos+10#$tReply ;; # Negative integer? 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 The word is expanded using tilde, parameter and variable expansion; arithmetic, command and process substitution; and quote removal. My focus is to write articles that will either teach you or help you resolve a problem.

I tried setting $VAR3 and $VERSION variables in quotes "", as well as the STR values used as the cases. The question does not have to be directly related to Linux and any language is fair game. Otherwise, it is the exit status of the last command executed in list. Using these terminators, a case statement can be configured to test against all patterns, or to share code between blocks, for example.