Home > Syntax Error > Syntax Error Do Unexpected

Syntax Error Do Unexpected

Contents

You could fix it by using "${file%$extension}$3" instead, but frankly I'd just use "${file%.*}$3" to remove the extension no matter what length it is (and I'd also redo the if comparisons Click Here to receive this Complete Guide absolutely free. where should the ; be placed? –Aquarius TheGirl Aug 7 '14 at 6:34 When using sudo you can't have commands which requires embedded semicolons. –Some programmer dude Aug 7 You can do that using a variety of tools but my preference is dos2unix To install it on CentOS, Fedora or RHEL do: sudo yum install dos2unix To install dos2unix on his comment is here

You previously marked this answer as accepted. I used the following regex: egrep "\"([^"]*)?\(([^"]*)?Linux([^"]*)?\)([^"]*)?\"" [FILE] But the problem is, I get bash: syntax error near unexpected token '(" every time. When I use the select command in a sh script it doesn't work, depending on how I format the command it will either return Unexpected "do" or Unexpected "done". egrep '\"([^"]*)?\(([^"]*)?Linux([^"]*)?\)([^"]*)?\"' [FILE] share|improve this answer answered Aug 28 at 15:03 Thomas 9322515 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using

Syntax Error Near Unexpected Token Do In Shell Script

Outlet w/3 neutrals, 3 hots, 1 ground? It compares all of the files in the directory to see if they are of the type of the first 2 parameters. how to match everything between a string and before next space more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info It also has $3 outside the quotes, which can cause trouble.

Remove advertisements Sponsored Links balajesuri View Public Profile Find all posts by balajesuri #3 05-05-2015 sea Registered User Join Date: Sep 2013 Last Activity: 14 October 2016, 2:49 Main Menu LQ Calendar LQ Rules LQ Sitemap Site FAQ View New Posts View Latest Posts Zero Reply Threads LQ Wiki Most Wanted Jeremy's Blog Report LQ Bug Syndicate Latest more hot questions question feed lang-bsh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Syntax Error Near Unexpected Token Do Mac So tried with command as : Code: $ dos2unix abc.sh dos2unix: converting file abc.sh to UNIX format ...

Presumably you're editing this in notepad and running it in cygwin, which is why you're getting this error. If they are, the script converts such files to the type of the third parameter using an FFMPEG command. I am required to do it in a Linux OS (using Virtual Box Terminal). syntax error: unexpected end of file error jedzio Shell Programming and Scripting 10 08-01-2014 10:03 AM sed error : Syntax error: redirection unexpected phpfreak Shell Programming and Scripting 3 12-04-2008 05:19

The "while read ..." will parse on lines and as long as on each line is only one value you are fine even if the values themselves contain whitespace. Do Unexpected In Shell Script How to write an effective but very gentle reminder email to supervisor to check the Manuscript? measurable linear functionals are also continuous on separable Banach spaces? What are some counter-intuitive results in mathematics that involve only finite objects?

Syntax Error Near Unexpected Token Do For Loop

Anthony J 08-05-2016 HI, I just watched the video. UNIX is a registered trademark of The Open Group. Syntax Error Near Unexpected Token Do In Shell Script Is the partition function of non-conformal theories on a torus modular invariant? Linux Syntax Error Near Unexpected Token Do Am I the only one having this issue?

Search this Thread 08-15-2011, 06:52 AM #1 rmaier9 LQ Newbie Registered: Aug 2011 Posts: 2 Rep: Bash script problem: syntax error near unexpected token `do Hello, I am having http://allconverter.net/syntax-error/syntax-error-fi-unexpected.html Not the answer you're looking for? French vs Italian resistance How secure is a fingerprint sensor versus a standard password? The line break takes care of it. Syntax Error Near Unexpected Token Do In Unix

and other countries. An electronics company produces devices that work properly 95% of the time how to match everything between a string and before next space Why does Snoke not cover his face? But it does not work. weblink The commas are a problem, too.

A pilot's messages Secret salts; why do they slow down attacker more than they do me? Syntax Error Near Unexpected Token Done' While Loop Really appreciate it! See http://stackoverflow.com/questions/2...ad-interpreter If that's the case you can try dos2unix or mac2unix to fix the script file, although they not be available on your flavor of Unix.

Complimenting the author of a textbook What mechanical effects would the common cold have?

All Rights Reserved. she-bang line starts with a hash symbol #! /bin/bash 2. Here is the code: #!/bin/bash # $1 is the first parameter passed # $2 is the second parameter passed # $3 is the third parameter passed for file in *.*; do Linux Unexpected Token Do Browse other questions tagged command-line 13.10 scripts or ask your own question.

How should I tell my employer? asked 1 year ago viewed 3959 times active 1 year ago Related 1/shell-script: syntax error near unexpected token `done'2bash: syntax error near unexpected token `('-1Syntax error in bash script: near unexpected How do I politely decline a research grant? check over here You should explicitly call the binary of the shell that runs with the code like this: sudo sh -c 'for n in $(seq 1 60); do echo "$n"; sleep 1; sync;

sjsam's advice to use shellcheck is good, but the short version is that you should be using square brackets instead of round ones on the internal brackets of your if statement: The time now is 11:22 PM. - Contact Us - UNIX & Linux - unix commands, linux commands, linux server, linux ubuntu, shell script, linux distros. - Advertising - Top Join our community today! You should be able to see if something is not terminated.

Finally, you need a fi (after the ffmpeg line) to end the conditional. asked 2 years ago viewed 145 times active 2 years ago Linked -1 Implementing which function in shell 8 syntax error near unexpected token ' - bash Related 3004Getting the Current/Present You could do egrep "\"([^\"]*)?\(([^\"]*)?Linux([^\"]*)?\)([^\"]*)?\"" FILE But a less ugly way is to quote the whole expression with single quotes, and in general always strong (single) quote your regex so the Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap - Main Menu Linux Forum Android Forum Chrome OS Forum Search LQ

asked 3 years ago viewed 1395 times active 3 years ago Linked 67 How can I create a select menu in a shell script? 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 The read and write part is executed by the 'heatFluxGather' code. Thanks Anthony.

you could do, echo myscript.sh | od -c to peak at the characters. I believe it's writing the file out in "DOS" format with the CR/LFs.