Home > Syntax Error > Unexpected Syntax Error Do

Unexpected Syntax Error Do

Contents

Since you use bash features, the first line of the file must be #!/bin/bash or #!/usr/bin/env bash. What does this ice key do? What is the "Chairman Tree"? On Ubuntu, /bin/sh is dash, a shell designed for fast startup and execution with only standard features. Source

You most likely have a carriage return or no-break space in your file. Modify functions in R using body, formals and environment methods Strange device identification How would a person see with an adjustable cross-shaped pupil? share|improve this answer answered May 13 '14 at 9:18 pRAShANT 190112 This solves a different problem, but not the syntax error. –chepner May 13 '14 at 12:14 add a 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

Syntax Error Near Unexpected Token Do For Loop

Appreciate it! And anyway, if you can't solve the problem with the information in this thread, ask a new question with the full content of the script and copy-paste the full error message(s). Each folder has a .txt file with some data I would like to collect and write into one .txt file. Is Certificate validation done completely local?

How do I handle an unterminated wire behind my wall? Run od -bc on your source file and paste the output in your question. –anubhava Aug 21 '13 at 21:37 @KeithThompson You're right that there is an error message share|improve this answer answered Mar 6 '15 at 9:20 Armali 3,91141355 add a comment| up vote 0 down vote Easy way to convert example.sh file to unix is use NotePad++ (Edit>EOL Syntax Error Near Unexpected Token Done' While Loop asked 3 years ago viewed 9765 times active 2 years ago Related 4Shell Script - syntax error near unexpected token `else'2command not found and syntax error near unexpected token2bash: syntax error

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 Linux Syntax Error Near Unexpected Token Do Solutions? asked 1 year ago viewed 890 times active 1 year ago Related 1/shell-script: syntax error near unexpected token `done'2Bash : syntax error near unexpected token ' done '4syntax error near unexpected http://stackoverflow.com/questions/23625397/syntax-error-near-unexpected-token-do Join them; it only takes a minute: Sign up syntax error near unexpected token “do” up vote 0 down vote favorite This shell script is throwing an error message : syntax

What are the German equivalents of “First World War”, “World War I”, and “WWI”? Syntax Error Near Unexpected End Of File AWS EC2 SSH from my IP address which has changed very lightweight low power microcontroller with memory? The 'file' command should tell you what they are (if that command is available on the Unix you are on). Nov 2 '15 at 3:11 add a comment| up vote 2 down vote What is the error you're getting? $ bash file.sh test.sh: line 8: syntax error: unexpected end of file

Linux Syntax Error Near Unexpected Token Do

Question: What is causing the syntax error near unexpected token `do' and how can I fix it? There is nothing about this line running as sudo that should stop it working to my knowledge, does anyone have any ideas? Syntax Error Near Unexpected Token Do For Loop This has been bothering me for a while now. Syntax Error Near Unexpected Token Do Mac while read filename do echo "$filename" if [ -s $filename ] then tail -10 $filename | grep date '+%Y-%m-%d' >> $lastlines1 echo "- Next Error File - " >> $lastlines1 else

regards Sajj. this contact form Why was Susan treated so unkindly? It was quite un-understandable at first, I think Word's hidden characters and/or formatting were the issue. Browse other questions tagged linux bash sudo watchdog or ask your own question. Syntax Error Near Unexpected Token Do In Unix

You can easily confirm this is with a simple example: # #!/bin/bash offfset=(`ls`) echo $offset Running this script with sudo will raise a syntax error in recent versions of Ubuntu and Linux is the registered trademark of Linus Torvalds in the U.S. In order to become a pilot, should an individual have an above average mathematical ability? http://crimsonskysoftware.com/syntax-error/unexpected-syntax-error.html If you are trying to only echo no errors once if no files are found, you need to use a flag to indicate it.

shell-script share|improve this question edited Jan 2 '13 at 13:14 mtk 4,265164383 asked Jan 2 '13 at 12:19 UNIX Learner 612 1 some general comments: You probably want to quote Syntax Error Near Unexpected Token Do R Last edited by tommylovell; 08-15-2011 at 07:56 AM. If edit in windows notepad any space take it as ^M.

g.

Syntax error: unexpected “(”-3Shell script- syntax error: unexpected end of file9Unexpected EOF and syntax error0Syntax Error: unexpected end of file — Bash script-1Syntax Error: unexpected end of file — Bash script1C Any recommendations as to how to fix or improve the script would be nice too. UNIX is a registered trademark of The Open Group. Do Unexpected In Shell Script 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.

Code: [[email protected] ~]# hexdump -C -n 64 heatFlux 00000000 23 21 2f 62 69 6e 2f 62 61 73 68 0a 0a 66 6f 72 |#!/bin/bash..for| 00000010 20 61 20 69 All rights reserved. You have two options to make sure the script is interpreted by bash: Move the shebang to the first line Run sudo like this: sudo bash ./pi_dev_env_install.sh share|improve this answer answered Check This Out Password Programming This forum is for all programming questions.

Thanks, Robert rmaier9 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by rmaier9 08-15-2011, 07:49 AM #2 tommylovell Member Registered: Nov 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 Integer function which takes every value infinitely often Is there a developers image of 16.04 LTS? Number sets symbols in LaTeX In order to become a pilot, should an individual have an above average mathematical ability?

Thanks for the explanation it's helped a lot and will be very useful to know in the future too. –kemra102 Aug 18 '12 at 12:25 Let me add that My code is: #!/bin/bash while : do echo "Press [CTRL+C] to stop.." sleep 1 done Saved it as .sh and ran bash file.sh CentOS 6 32-bit What is the issue? Browse other questions tagged bash osx select or ask your own question. Is there a syntax error that I am not seeing?

What to do when majority of the students do not bother to do peer grading assignment? Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. In other words the while-do-done and if-then-else-fi clauses are overlapping. I'm pretty new to this level of bash scripting ...

During the "Lecture: Identify CPU/Memory Intensive Processes, Adjust Process Priority with Renice, and Kill Processes (Part 2)" Anthony wrote the following script in the command line: [while true; do echo -n Why is this the case? Do pulled hair from the root grow back? 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;

Does it give you some message? The read and write part is executed by the 'heatFluxGather' code. 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 Sep 16 at 18:26 add a comment| up vote 0 down vote There's a way you can get this problem without having mixed newline problems (at least, in my shell, which