Home > Syntax Error > Bash Script Syntax Error Near Unexpected Token Do

Bash Script Syntax Error Near Unexpected Token Do

Contents

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 Code: [[email protected] ~]# file heatFlux heatFlux: Bourne-Again shell script, ASCII text executable Code: [[email protected] ~]# unix2dos heatFlux unix2dos: converting file heatFlux to DOS format ... [[email protected] ~]# file heatFlux heatFlux: Bourne-Again Realism of a setting with several sapient anthropomorphic animal species Does mean=mode imply a symmetric distribution? current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. this contact form

The variable reference "${file%.extension}"$3 will try to remove ".extension" (not the variable, just the string) from the end of $file. Symbolic comparison of recursive functions Force Microsoft Word to NEVER auto-capitalize the name of my company Skipping directly to level 4 Is it possible to check for existence of member template asked 2 years ago viewed 9062 times active 2 years ago Related 4Script doesn't work when executed with sudo3syntax error near unexpected token `('1syntax error near unexpected token `if'0syntax error near 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

Linux Syntax Error Near Unexpected Token Then'

asked 7 months ago viewed 417 times active 7 months ago Related 0Shell script - syntax error near unexpected token `['-1Syntax error in bash script: near unexpected token `else'5While command not rmaier9 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by rmaier9 08-21-2014, 05:20 AM #4 praju1 LQ Newbie Registered: Aug 2014 Posts: If you had edited/created this on a windows machine and copied to *nix, a 'dos2unix' will fix this. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community.

Reply Log In to Comment 0 dinhhoangviet May 18, 2014 I copied and created new file with the code in example of the link: #!/bin/bash COUNTER=0 while [ $COUNTER -lt 10 My home country claims I am a dual national of another country, the country in question does not. Is my workplace warning for texting my boss's private phone at night justified? Syntax Error Near Unexpected Token Do R Why write an entire bash script in functions?

Good way to explain fundamental theorem of arithmetic? Linux Syntax Error Near Unexpected Token Newline' Are you new to LinuxQuestions.org? 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. Not the answer you're looking for?

Why did companions have such high social standing? Syntax Error Unexpected Do Meaning of Guns and ghee Unexpected parent process id in output How's the CMD trip bonuses from extra legs work? 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 Any hint of where I went wrong would be greatly appreciated. –Avi May 11 at 1:54 1 To be honest, i can see only the shebang line is correct in

Linux Syntax Error Near Unexpected Token Newline'

Why are some programming languages Turing complete but lack some abilities of other languages? How to map and sum a list fast? Linux Syntax Error Near Unexpected Token Then' Click Here to receive this Complete Guide absolutely free. Syntax Error Near Unexpected Token Do For Loop If you are trying to only echo no errors once if no files are found, you need to use a flag to indicate it.

Anyway, here's my quick rewrite: #!/bin/bash # $1 is the first parameter passed # $2 is the second parameter passed # $3 is the third parameter passed for file in *.*; weblink 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 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. 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 Syntax Error Near Unexpected Token Do Mac

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. Browse other questions tagged bash unix ffmpeg or ask your own question. What are the canonical white spaces? navigate here Video displays in Star Wars Can Customs make me go back to return my electronic equipment or is it a scam?

Not the answer you're looking for? Syntax Error Near Unexpected Token In Shell Script Can somebody help me ? Is it possible to check for existence of member template just by identifier?

On THE other hand or on another hand?

Join our community today! 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 see that you have run the file through dos2unix but I would still recommend you run it through something similar once more: tr -d '\015' < src.sh > dst.sh share|improve Unexpected End Of File Bash That was my bug! –Avi May 11 at 2:03 1 Glad to hear it, although Gordon's answer below is much more thorough than mine - I corrected the 'if[' missing

The question does not have to be directly related to Linux and any language is fair game. Will the medium be able to last 100 years? Using Map to convert Feet + Inches to Inches in a List of Lists Why don't most major game engines use gifs for animated textures? http://sovidi.com/syntax-error/bash-for-syntax-error-near-unexpected-token.php Which requires more energy: walking 1 km or cycling 1 km at the same speed?

Is this safe to display MySQL query error in webpage if something went wrong? 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 How to pluralize "State of the Union" without an additional noun? The bash just retrieves the data.

Sign into your account, or create a new one, to start interacting.