Home > Unexpected End > Unexpected End Of File Error In Shell Script

Unexpected End Of File Error In Shell Script

Contents

EOF I prefer the second because it lets you structure the script a lot better... Does Nietzsche's rejection of Socrates mean that he is a relativist about ethics? Not the answer you're looking for? Are assignments in the condition part of conditionals a bad practice? check over here

The Finslerian version of the Nash embedding theorem Split python tuple in subtuples with capacity limit in functional programming style How can I make two cutting lines close to each other? Put fi on a line of its own (or put a ; before it). [ "$3" < 50 ] is the same as [ "$3" ] < 50 — it's the To fix this problem, change line 5 to read: if [ "$number" = "1" ]; then Now when the shell performs the substitution it will see: if [ "" = "1" Split python tuple in subtuples with capacity limit in functional programming style fraction line in French In order to become a pilot, should an individual have an above average mathematical ability?

Bash Unexpected End Of File While Looking For Matching

You can use cat -vet scriptname to check (look for "^M$" at the ends of lines, instead of just "$"). –Gordon Davisson Jun 17 '15 at 6:29 On a How to create a torus with divided cuts that correspond to the direction of the torus Partial sum of the harmonic series between two consecutive fibonacci numbers What do you call Please use the new version at LinuxCommand.org LinuxCommand Learningtheshell Writingshellscripts Script library SuperMan pages Who, What, Where, Why Tips, News And Rants Previous | Contents | Next Stay Out Of Trouble

  • is searched.
  • 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.
  • Why was Susan treated so unkindly?
  • command <<-EOF ...
  • I agree with camh, that correct indentation from the beginning helps to avoid such errors.
  • Search this Thread 04-29-2010, 10:24 AM #1 roxie600 LQ Newbie Registered: Apr 2010 Posts: 5 Rep: Shell Scripting "syntax error : unexpected end of file" hey I am very
  • SXA Page Design vs Page Standard Values vs Page Branch Template Hilbert-irreducible Banach space In order to become a pilot, should an individual have an above average mathematical ability?

It also explains the rest of the error message we received. Fixed by running dos2unix on the script, with proper description of problem and solution given in that answer share|improve this answer answered Feb 6 '15 at 9:47 shtolik 362713 add a Integer function which takes every value infinitely often Are assignments in the condition part of conditionals a bad practice? Syntax Error Near Unexpected Token `fi' PSM Last edited by paulsm4; 04-29-2010 at 04:55 PM.

I was trying to write a script to which is throwing an unexpected end of file error. Syntax Error Unexpected End Of File Bashrc What to do when majority of the students do not bother to do peer grading assignment? Strange device identification Why does removing Iceweasel nuke GNOME? Do pulled hair from the root grow back?

Please accept my apologies, but I am really nooby in sh scripts. Delimited By End-of-file (wanted `eof') If the script runs, as far as it can, then the problem is in the other half. What game is the guard playing in this picture? The Finslerian version of the Nash embedding theorem Hilbert-irreducible Banach space Why is C# Dim a Chord in B Minor?

Syntax Error Unexpected End Of File Bashrc

Solutions? http://www.linuxquestions.org/questions/programming-9/shell-scripting-syntax-error-unexpected-end-of-file-804990/ Than it work fine –shubham kumar Mishra Feb 12 '15 at 11:51 add a comment| up vote 0 down vote I have found that this is sometimes caused by running a Bash Unexpected End Of File While Looking For Matching LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] Shell Scripting "syntax error : unexpected end of file" User Name Remember Me? Syntax Error Unexpected End Of Input Does Nietzsche's rejection of Socrates mean that he is a relativist about ethics?

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 http://centralpedia.com/unexpected-end/unexpected-end-of-file-error.html The best way to spot these is to use correct indentation, which will show you where you have a broken control structure, and syntax highlighting, which will show you where quotes Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You should get this: [[email protected] me]$ ./trouble.bash ./trouble.bash: line 8: unexpected EOF while looking for matching " ./trouble.bash: line 10 systax error: unexpected end of file Here we have another case Shell Script Validator

Appreciate that. I had to run it as bash instead of sh. Why do we need blockchains? http://centralpedia.com/unexpected-end/unexpected-end-of-file-error-in-c.html Having a problem logging in?

How to draw a clock-diagram? Syntax Error Unexpected End Of File Python deadeyes View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by deadeyes 04-29-2010, 11:03 AM #3 catkin LQ 5k Club Registered: Dec 2008 share|improve this answer answered Mar 13 '14 at 5:10 musthafa 112 add a comment| up vote 0 down vote I had the issue this issue when I wrote the script in

Clean up your code, and errors start to stand out.

Be sure to enter it exactly as written. #!/bin/bash number=1 if [ $number = "1" ]; then echo "Number equals 1" else echo "Number does not equal 1" fi When you Why are only passwords hashed? I have found the error and fixed it! –Scott Pearce Mar 29 '15 at 22:09 add a comment| Not the answer you're looking for? Syntax Error Near Unexpected Token `done' command is syntactically invalid, and you need a space before the closing bracket of an if test.

Please visit this page to clear all LQ-related cookies. syntax error: unexpected end of file error Hello, I have another problem with my script. Strange device identification Why does Wikipedia list an improper pronunciation of Esperanto? http://centralpedia.com/unexpected-end/unexpected-end-of-file-error-in-php.html We usually only see this problem on files that have been copied from Windows systems to UNIX and Linux systems.

If possible, how to include cut marks in PDF? (using watermark?) Why do the Sparkfun and Adafruit Eagle libraries use smaller footprints than the manufacturer's recommended land pattern? I meant : elif (( $2 < 59 )); then s=$3-50 m=$2+1 h=$1 else s=$3-50 m=0 h=$1+1 fi –Sam Jun 3 '12 at 18:40 add a comment| up vote 0 down As you gain experience tracking down bugs, you will discover that bugs are often not where you first expect to find them. 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

Please find below whole script: Code: #!/bin/bash echo "=== Checking logs ===" returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if [ -n "${returned}" ]; then echo "There is no Why do we need blockchains? Number does not equal 1 As you can see, bash displayed an error message when we ran the script. We saw this in our earlier discussion on stubbing.

But this script: #!/bin/bash for i in `seq 1 5`; do echo $i done ...outputs this error: Syntax error: end of file unexpected (expecting "done") Is there something wrong with that Find More Posts by ilikejam 04-29-2010, 12:30 PM #6 catkin LQ 5k Club Registered: Dec 2008 Location: Tamil Nadu, India Distribution: Debian Posts: 8,576 Blog Entries: 31 Rep: The command <

Development of retrosynthesis plan Former boss asking me to do presentations Why was Susan treated so unkindly? Browse other questions tagged bash shell-script or ask your own question. To get that error message from bash for the command: set -xv, you must be using an editor that uses the DOS convention of carriage-return followed by newline as the line Minimum of a function on an open interval Former boss asking me to do presentations Is giving my girlfriend money for her mortgage closing costs and down payment considered fraud?

TNG Season 5 Episode 15 - Is the O'Brien newborn child possessed, and is this event ever revisited/resolved/debunked? I set the permissions to 777 and +x so it should work with the 'sh' command, right... How could a language that uses a single word extremely often sustain itself? more problems: If you do a grep (-A1: + 1 line context) grep -A1 "if " cldtest.sh you find some embedded ifs, and 4 if/then blocks.