Home > Unexpected Token > Syntax Error Near Unexpected Token Do For Loop

Syntax Error Near Unexpected Token Do For Loop

Contents

I would execute the script with the following command: ./convert.sh .avi .mp4 .flv That this, this script would convert all of the .avi and .mp4 files to .flv. Browse other questions tagged bash shell-script scripting or ask your own question. and other countries. × LinkedIn Comment LinuxAcademy.com Cancel Share powered byOlark live chat software gxcherie 博客园 首页 新随笔 联系 订阅 管理 随笔 - 55 文章 - 0 评论 - 5 写shell,运行出错:syntax 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 http://mmonoplayer.com/unexpected-token/syntax-error-near-unexpected-token-newline-39-xml.html

Join our community today! I had an errant alias command in my ~/.bashrc pointing 'dot' to c:\program files (X86)/.... In the video we are using ( and not [ here is the correct line which is used in the video (while true; do echo -n "my program" >> ~/output.file; sleep What are some counter-intuitive results in mathematics that involve only finite objects?

Syntax Error Near Unexpected Token Do For Loop

Anxious about riding in traffic after 20 year absence from cycling Why does Davy Jones not want his heart around him? The easiest way to fix this is to put the loop inside a file and execute it, like sudo /bin/bash ./myfile share|improve this answer answered Aug 7 '14 at 6:32 Some share|improve this answer answered Feb 24 at 6:27 CodeGnome 3,1411619 1 Ahh, that makes sense now! I'm pretty new to this level of bash scripting ...

Please click the link in the confirmation email to activate your subscription. The bash just retrieves the data. Change syntax of macro, to go inside braces how to match everything between a string and before next space split strings and add them as new row Word that includes "food, Syntax Error Near Unexpected Token Done' While Loop Will majority of population dismiss a video of fight between two supernatural beings?

Tips like this are very helpful as I really want to improve my bash scripting knowledge. Syntax Error Near Unexpected Token Do Mac if conditionals end with then (either on the next line, or after a ;) not { You could fix it like this: if [ \( "${file: -4}" = "$1" \) -o Lagrange multiplier on unit sphere How to decrypt .lock files from ransomeware on Windows How do I politely decline a research grant? They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

praju1 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by praju1 Thread Tools Show Printable Version Email this Page Search this Thread Advanced Linux Unexpected Token Do the sum of consecutive odd numbers What do you do with all the bodies? 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 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

Syntax Error Near Unexpected Token Do Mac

Unix & Linux Stack Exchange works best with JavaScript enabled current community chat Unix & Linux Unix & Linux Meta your communities Sign up or log in to customize your list. Understanding the grammar: «illis Evangelii nuntiandi praebens mandatum» Schengen visa to Norway to visit my wife refused Why would Snape set his office password to 'Dumbledore'? Syntax Error Near Unexpected Token Do For Loop And I think you want an explicit path to the file in your remove command. (If you have a script with references to a particularly long path or one that is Syntax Error Near Unexpected Token Do In Unix Most useful knowledge from the 30's to understand current state of computers & networking?

t x t . / \n \n \t \t e 0000220 c h o / h o m e / C F D _ F i [[email protected] ~]# See my lineend http://mmonoplayer.com/unexpected-token/unexpected-token-error-in-r.html How to reward good players, in order to teach other players by example Outlet w/3 neutrals, 3 hots, 1 ground? 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 An expensive jump with GCC 5.4.0 Difficulties interpreting this complex sentence more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info Do Unexpected In Shell Script

How do I politely decline a research grant? Square root image filter tool in Python Deep theorem with trivial proof How to properly localize numbers? Feynman diagram and uncertainty Outlet w/3 neutrals, 3 hots, 1 ground? http://mmonoplayer.com/unexpected-token/syntax-error-near-unexpected-token-39-bash.html Complimenting the author of a textbook Will majority of population dismiss a video of fight between two supernatural beings?

how to match everything between a string and before next space Disease that requires regular medicine Need a way for Earth not to detect an extrasolar civilization that has radio Square Syntax Error Near Unexpected Token Do R 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 Do you have any idea about why I am getting this error in this while loop?

Click Here to receive this Complete Guide absolutely free.

It compares all of the files in the directory to see if they are of the type of the first 2 parameters. Based on your recommendation, I just opened a new file and rewrote the script with some of your advice, and it worked great. 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 Syntax Error Near Unexpected Token ' In Shell Script Amplifier circuit woe 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

The bad revision 3 of the question hides this by distorting the error message, which previously readsyntax error near unexpected token `do - note the lone grave accent (`), which bash more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Hit a curb today, taking a chunk out of the tire and some damage to the rim. check over here UNIX is a registered trademark of The Open Group.

Hope this helps. LinuxQuestions.org > Forums > Non-*NIX Forums > Programming Bash script problem: syntax error near unexpected token `do User Name Remember Me? Linux is the registered trademark of Linus Torvalds in the U.S. Why is a semicolon needed only inside a for loop, but not outside of it? –9a3eedi Oct 28 '15 at 6:59 And thanks for noticing my other unrelated mistake

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. If I put a semicolon like in your example, I get a syntax error! To fix it, run the loop in a subshell, either as a separate script, or like this; sudo sh -c 'for n in $(seq 1 60); do echo $n; sleep 1; Feynman diagram and uncertainty Bounce off the atmosphere at reentry?

Rebus: Guess this movie Why does MIT have a /8 IPv4 block? Cheers. Every if needs a then and a fi. Is an internal HDD with Ubuntu automatically bootable from an external USB case?

share|improve this answer answered Aug 7 '14 at 6:40 tripleee 61.1k864119 add a comment| up vote 2 down vote for is an internal function (not to be confused with functions) of You may have other problems with your code as well, but this message is likely coming from the fact that you can't have a do keyword as if it were a This is symptomatic of unexpected CR characters in the text file. I don't understand some of the error messages well on shellcheck.

Can a free radical be created by chemical reaction of non-radical species? Please visit this page to clear all LQ-related cookies. Word that includes "food, alcoholic drinks, and non-alcoholic drinks"?