Home > Syntax Error > Bash For Loop Syntax Error Unexpected End Of File

Bash For Loop Syntax Error Unexpected End Of File

Contents

Downvoting. If not, why? im not exactly sure where the code goes wrong –markcruz Jun 16 '11 at 2:43 weird, i cut and pasted your code and it worked as expected. Can filling up a 75 gallon water heater tank without opening a faucet cause damage? this contact form

Not the answer you're looking for? Why does Windows show "This device can perform faster" notification if I connect it clumsily? This is a classic mistake Read the error messages Many people come into IRC and ask something like "Why does my script fail? The first example works just fine (but when I add the code echo "hello world" >> "Result.txt" - I get the error message in my first message).

Syntax Error Unexpected End Of File Bash Script

I wrote this code now: Code: #!/bin/bash cat $1 |while read line; do echo "$line" done <$1 and I get an error "No such file or directory", but without the <$1 adidoosh100 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by adidoosh100 08-07-2010, 10:07 AM #12 grail LQ Guru Registered: Sep 2009 Location: Why did companions have such high social standing? I've changed that and now it all works great.

Number does not equal 1 As you can see, bash displayed an error message when we ran the script. Thank you. As you gain experience tracking down bugs, you will discover that bugs are often not where you first expect to find them. Syntax Error Unexpected End Of File Python surprised I need to google this many pages before running into this answer. –Derek Jul 3 '13 at 6:01 Whats the reason behind this problem?

However, I got the error of unexpected EOF. Syntax Error Unexpected End Of File Php Please explain the local library system in London, England Do COB LEDs usually need electrically insulating from the heatsink? The Woz Monitor What are the canonical white spaces? However, my Text editor was set to using LF and I recheck this by delete all EOL and re-added.

Forgetting that will get you the same syntax error: unexpected eof. –Cbhihe Jun 19 '15 at 8:45 This answer is seriously underrated. –yvanscher Feb 11 at 20:27 add a Syntax Error Unexpected End Of File Unix Browse other questions tagged bash makefile or ask your own question. Too many arguments !": event not found syntax error near unexpected token `(' The CRLF issue What is the CRLF issue? Browse other questions tagged bash shell-script or ask your own question.

Syntax Error Unexpected End Of File Php

Image if the input file was generated by some other process and it is to be used in a script. Lewis –Lewis Wheeler Mar 4 '12 at 15:17 add a comment| up vote 0 down vote I also got this problem. Syntax Error Unexpected End Of File Bash Script no outgoing connection via ipv4 How to deal with a very weak student? Syntax Error Unexpected End Of File Wordpress Why write an entire bash script in functions?

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. http://sovidi.com/syntax-error/bash-if-statement-syntax-error-unexpected-end-of-file.php Adopt A Jet/Book Verbs of buttons on websites What to tell to a rejected candidate? How did a CR end up in my file? Code: cat -vet script_name shamrock View Public Profile Find all posts by shamrock #4 07-02-2008 alias_juju Registered User Join Date: Jul 2008 Last Activity: 3 Syntax Error Unexpected End Of File Shell Script

How does the pilot control the Dassault Rafale? asked 4 years ago viewed 4268 times active 1 year ago Linked 1 Looping a Bash Shell Script Related 542Looping through the content of a file in Bash?29Bash syntax error: unexpected For example, when we were looking for our missing quotation we could have done this: #!/bin/bash number=1 if [ $number = "1" ]; then echo "Number equals 1 #else # echo navigate here I do not get any ether when mining Unexpected parent process id in output Finding a file starting with '-' dash So sayeth the Shepherd What does Sauron need with mithril?

EOF cat «EOF default colors are: ${lc}- shell level color: cyan ${sc}- script name: yellow ${lnc}- line number: red ${fc}- function name: green ${cc}- command executed: white EOF } debug_cmd() { Syntax Error Unexpected End Of File Laravel 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 For example this scripts works ok: echo "hello" it prints "hello" with no errors.

Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community.

grail View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by grail 08-07-2010, 05:39 AM #3 adidoosh100 LQ Newbie Registered: Aug 2010 Posts: So, this rule: list-header: for file in a.cpp b.cpp b.h do echo "$file includes headers: " grep -E '^#include' $file | cut -f2 done will cause make to invoke the shell American English: are [ə] and [ʌ] different phonemes? Syntax Error Unexpected End Of File Expecting Function (t_function) adidoosh100 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by adidoosh100 08-07-2010, 06:27 AM #8 grail LQ Guru Registered: Sep 2009 Location:

script.sh: line 50: unexpected EOF while looking for matching `"' script.sh: line 100: syntax error: unexpected end of file This one indicates the double-quote opened in line 50 does not have Note that semicolon inside the squiggly brackets, just after calling some previously defined function 'usage'. This is the default. his comment is here The second type displays the value of a variable (or variables) used in a calculation or test.

Usage: $0 host database username" exit 0 fi Or, since you're using bash, you could use built-in syntax: if [[ $# -lt 3 || $# -gt 3 ]]; then echo "Error... Watching your script run It is possible to have bash show you what it is doing when you run your script. The second problem you may have is that your filenames may have spaces in it. You have indicated, by using $1, that you are passing the name of a file.

Least Common Multiple How to indicate you are going straight? Syntax highlighting helps you see (you guessed it) syntax errors, such as unclosed quotes and braces, typos, etc. Thank you, Adi. The various parts of the script prompt are printed in color.

We saw this in our earlier discussion on stubbing. If it's printed to your terminal, a carriage return will effectively place the cursor at the beginning of the current line. spectral norm of block-wise sums of matrices What does an 'ü' mean? When I find some time, I'll paste 2 or 3 IRC log-snips here, just to show you that annoying fact.