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 Browse other questions tagged bash shell-script or ask your own question. asked 2 years ago viewed 3825 times active 2 years ago Related -3Shell script- syntax error: unexpected end of file2syntax error: unexpected end of file-1syntax error: unexpected end of the file0unexpected asked 3 years ago viewed 16343 times active 3 years ago Related 6How do the environments of a standard Terminal command-line and a bash script differ?12Problem with Bash script: 'declare: not Check This Out
I did not get a syntax error. paulsm4 View Public Profile View LQ Blog View Review Entries View HCL Entries Visit paulsm4's homepage! Use echo commands to verify your assumptions. As Gordon suggested, change that to: if nc -z $Host $Port then ... see this here
Does Nietzsche's rejection of Socrates mean that he is a relativist about ethics? I am confused, I have an if statement at last and it looks correct! It is pointing at the line whee the function is called. #!/bin/sh expected_diskusage="264" expected_dbconn="25" expected_httpdconn="20" expected_cpuusage="95" #expected_fd="100" httpdconn=`ps -ef|grep -i httpd|grep -v grep|wc -l` #httpd connections cpu_usage=`ps aux|awk 'NR > 0 Thank you in advance ..
Obviously, it's more different then coding then I thought. 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 bash unix shell share|improve this question edited Jun 16 '15 at 20:09 krisFR 7,45621025 asked Jun 16 '15 at 20:03 Raghavendra 111 Is your script in DOS/Windows format (\r\n http://unix.stackexchange.com/questions/114138/shell-unexpected-end-of-file-error Browse other questions tagged bash scripts or ask your own question.
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 `fi' To combat this, you should place echo commands in your code while you are debugging, to produce messages that confirm the program is doing what is expected. Run the file ("./tmp.sh") with no arguments 6. You have to check that.
How to select citizen justices? http://linuxcommand.org/wss0100.php What is way to eat rice with hands in front of westerners such that it doesn't appear to be yucky? Bash Unexpected End Of File While Looking For Matching Extraneous carriage returns in shell scripts, source code for other languages, and in data files will cause you no end of grief.
What to do when majority of the students do not bother to do peer grading assignment? his comment is here Here is what it looks like: [[email protected] me]$ ./trouble.bash + number=1 + '[' 1 = 1 ']' + echo 'Number equals 1' Number equals 1 Alternately, you can use the set What game is the guard playing in this picture? How strange is it (as an undergrad) to email a professor from another institution about possibly working in their lab? 2011 MacBook Pro upgrade? Syntax Error Unexpected End Of File Python
It worked before. What happens is the shell keeps looking for the closing quotation mark to tell it where the end of the string is, but runs into the end of the file before What are the German equivalents of “First World War”, “World War I”, and “WWI”? this contact form From this we can determine that the error is occurring on line 5 not line 3.
Use code blocks (the "#" symbol on the LQ toolbar). Delimited By End-of-file (wanted `eof') I set the permissions to 777 and +x so it should work with the 'sh' command, right... page="$(curl http://www.google.com/| grep "title")" if [ -z "$page" ]; then echo "Empty page" else echo "Valid page" fi When am running in another machine, I am getting the error syntax error:
I will continue working that way from now on. I don't see why the following would make any difference in the behavior of your script (except that if there are multiple errors found, they will be printed on separate lines; Number sets symbols in LaTeX Before I leave my company, should I delete software I wrote during my free time? Syntax Error Near Unexpected Token `done' 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
This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. Regards, Adrian Remove advertisements Sponsored Links jedzio View Public Profile Find all posts by jedzio #2 07-31-2014 Don Cragun Administrator Join Date: Jul 2012 In order to become a pilot, should an individual have an above average mathematical ability? navigate here How can I make two cutting lines close to each other?
These errors can be a real pain to find in a long script. This brings up an important thing to remember when you are writing your scripts. By doing this, you can isolate which part of a program is causing (or not causing) a problem. The first type simply announces that you have reached a certain point in the program.
Who was Mikael Blomkvist with at the end of the movie and why did Lisbeth hate it so much? If that's the case dos2ux should fix that. How do I handle an unterminated wire behind my wall? AWS EC2 SSH from my IP address which has changed Why can't the second fundamental theorem of calculus be proved in just two lines?
reverses it to 'if not': Code: if ! Why does Wikipedia list an improper pronunciation of Esperanto? I haven't reviewed your logic. My first comment would be that you should change: Code: echo $returned to: Code: echo "$returned" or better yet (removing problems that could be caused depending on the contents of SapLogs.log):
In this particular case, I can see you are missing a fi. To do this, add a "-x" to the first line of your script, like this: #!/bin/bash -x Now, when you run your script, bash will display each line (with substitutions performed) Consider what happens if a variable is set to equal nothing. Missing quotes Edit line 6 to remove the trailing quote from the end of the line: echo "Number equals 1 and run the script again.
We don't want the > /dev/null here because this code is replacing earlier code that was: Code: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned and then checking whether "$returned"