This time you should get the following: [[email protected] me]$ ./trouble.bash /trouble.bash: [: =: unary operator expected. My comment was really in response to T3RM1NVT0R's post, where he recommended using "quote or code [tags]". 1 members found this post helpful. It's Yes or No!" ;; esac done Last edited by David the H.; 12-29-2011 at 12:47 PM. zQUEz, I will keep this in mind if it bombs out as is. http://gatoisland.com/syntax-error/bash-syntax-error-end-of-file-unexpected.php
Yes, of course I'm an adult! If you get weird and illogical messages from your script, rule out the possibility that^M is involved. 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 Can filling up a 75 gallon water heater tank without opening a faucet cause damage?
Note: It seems that here-documents (tested on versions 1.14.7, 2.05b, 3.1.17 and 4.0) are correctly terminated when there is an EOF before the end-of-here-document tag (see redirection). When I find some time, I'll paste 2 or 3 IRC log-snips here, just to show you that annoying fact. What does an 'ü' mean? Password Linux - Newbie This Linux forum is for members that are new to Linux.
Use -le for less than or equal. –Stéphane Chazelas Jul 28 at 7:33 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote You missed a fi They are only supposed to be used to repeat and highlight something another person has said. Watching your script run It is possible to have bash show you what it is doing when you run your script. Bash Syntax Error Near Unexpected Token The difference lies in the use of the CR (Carriage Return) and LF (Line Feed) characters.
To understand this error, we have to see what the shell sees. You can install dos2unix in ubuntu with this: sudo apt-get install dos2unix share|improve this answer answered Jun 16 '11 at 2:50 clyfish 4,98311822 thanks guys! Finally, where are all your closing `fi`'s? command-line bash scripts share|improve this question edited Sep 3 '13 at 21:57 Braiam 38.8k1691153 asked Sep 3 '13 at 8:29 user568021 2952619 How do you run the above script?
http://sourceforge.net/projects/basheclipse/ Paolo Supino, 2012/01/02 10:20 not knowing of bash debugger existance I wrote a small script (I called debug.sh) that sets -x, -xv or -xvn (depending on the parameter passed debug.sh). Bash Syntax Error Near Unexpected Token Newline Inject debugging code Insert echos everywhere you can, and print to stderr: echo "DEBUG: current i=$i" >&2 If you read input from anywhere, such as a file or command substitution, print up vote 3 down vote favorite I can't normally run sh scripts. Why?
What to tell to a rejected candidate? Please explain the local library system in London, England What is the sh -c command? Bash If Else Does mean=mode imply a symmetric distribution? 1 Syntax Error End Of File Unexpected 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.
A name for a well-informed person who is not believed? his comment is here What did you say? But, sometimes even though every syntax is correct, you may still get this error. share|improve this answer edited Aug 21 '15 at 18:05 answered Aug 21 '15 at 18:03 ghoti 24.8k22760 I can confirm that using DOS line endings produces a syntax error. Syntax Error Unexpected End Of File In Shell Script
Religious supervisor wants to thank god in the acknowledgements Verbs of buttons on websites Should indoor ripened tomatoes be used for sauce? To display CRs (these are only a few examples) in VI/VIM: :set list with cat(1): cat -v FILE To eliminate them (only a few examples) blindly with tr(1): tr -d '\r' Hey David, maybe I'm too tired tonight, but I cannot see any quoted code here, nor any editing after your post. http://gatoisland.com/syntax-error/bash-for-loop-syntax-error-unexpected-end-of-file.php None of the other fancy-style quotation marks can be used in shell syntax patterns.
Fixed. Syntax Error Unexpected End Of File Php How to deal with a very weak student? Note that semicolon inside the squiggly brackets, just after calling some previously defined function 'usage'.
I get this error message : "sub_change_dirrect: line 14: syntax error: unexpected end of file" bash scripts share|improve this question edited Jun 3 '12 at 12:54 adempewolff 5,60011943 asked Jun 3 The reason is unknown, but it seems to be deliberate. asked 1 year ago viewed 11081 times active 1 year ago Linked -1 Syntax Error: unexpected end of file — Bash script Related 5“unexpected end of file” in bash script-3Shell script- Syntax Error Unexpected End Of File Wordpress I would request you to use quote or code to keep the indenting of the script when you are posting in the thread.
asked 2 years ago viewed 18603 times active 2 months ago Related 0Shell script - syntax error near unexpected token `['2bash: syntax error near unexpected token `}'-1Syntax error in bash script: Consider what happens if a variable is set to equal nothing. A simple it didn't work for me suffices. navigate here If you ever got to execute this line, you'd see an error bash: fi: command not found.
LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie bash script syntax error: unexpected end of file? Why did companions have such high social standing? Last edited by colucix; 12-28-2011 at 02:13 PM. 1 members found this post helpful. Downvoting.
This site is not affiliated with Linus Torvalds or The Open Group in any way. They do not preserve formatting in any way. READ YOUR ERROR MESSAGES! Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community.
Skeletal formula for carbon with two double bonds Force Microsoft Word to NEVER auto-capitalize the name of my company Is the following extension of finite state automata studied? View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by David the H. 12-28-2011, 05:15 PM #6 colucix LQ Guru Registered: Sep 2003 colucix View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by colucix 12-28-2011, 04:48 PM #5 David the H. It's easy to imagine the ^M is bad in other places too.