Syntax Error Unexpected End Of File
The script : #!/bin/bash declare -i s declare -i m declare -i h if [ "$3" < 50 ]; then s=$3+10 m=$2 h=$1 else if ["$2" < 50 ]; then s=$3-50 Everything was working fine, but since yesterday I keep getting this error: ./spritz: line 176: syntax error: unexpected end of file I have checked the script file and everything seems perfect. asked 3 years ago viewed 16948 times active 3 years ago Related 6How do the environments of a standard Terminal command-line and a bash script differ?14Problem with Bash script: 'declare: not From this we can determine that the error is occurring on line 5 not line 3. http://allconverter.net/syntax-error/syntax-error-end-of-file-unexpected.html
share|improve this answer edited Mar 27 '12 at 12:54 answered Mar 27 '12 at 9:27 user unknown 21.1k74292 add a comment| up vote 1 down vote You've got an unclosed quote, Eating Skittles Like a Normal Person Why are terminal consoles still used? What are the downsides to multi-classing? Add a language to a polyglot What are the downsides to multi-classing?
Syntax Error: Unexpected End Of File Bash
or recreate the script in linux iteself. Remember that "[" is an abbreviation for the test shell builtin. This site is not affiliated with Linus Torvalds or The Open Group in any way. You will see a problem develop at a certain point in your program and assume that the problem is there.
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 Either use the numeric comparison operator -lt, or use an arithmetic instruction (( … )). share|improve this answer answered Sep 3 '13 at 8:42 Frantique 5,5461637 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign Syntax Error Near Unexpected Token `fi' UNIX is a registered trademark of The Open Group.
To the shell, this looks like three assignments that apply to the command fi. Bash Unexpected End Of File While Looking For Matching In this particular case, I can see you are missing a fi. It also explains the rest of the error message we received. Stay logged in Linux.org Forums > LINUX.ORG Home Home Quick Links Recent Activity What's New?
This technique is called tracing. Shell Script Validator If you don't get the expected output, check your typing; you made a mistake. Will majority of population dismiss a video of fight between two supernatural beings? It is useful to know that program flow is happening the way we expect.
Bash Unexpected End Of File While Looking For Matching
current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. Browse other questions tagged bash scripts or ask your own question. Syntax Error: Unexpected End Of File Bash bash unix shell share|improve this question edited Jun 16 '15 at 20:09 krisFR 7,59121125 asked Jun 16 '15 at 20:03 Raghavendra 111 Is your script in DOS/Windows format (\r\n Syntax Error Unexpected End Of File In Codeigniter 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
If you can't see it just by looking (I'd recommend a syntax colouring editor and a neat indentation style), take a copy of the script, and delete half of it, cutting this content The loop it looks ok. –Radu Rădeanu Sep 3 '13 at 8:32 I run it with the sh command: sh script.sh –user568021 Sep 3 '13 at 8:36 use (( )) for arithmetic comparison. –geirha Jun 3 '12 at 14:47 @geirha Oh, yes, of course. If the script runs, as far as it can, then the problem is in the other half. Syntax Error Unexpected End Of Input
Feynman diagram and uncertainty What mechanical effects would the common cold have? 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 Is an internal HDD with Ubuntu automatically bootable from an external USB case? http://allconverter.net/syntax-error/syntax-error-unexpected-end-of-file-ruby.html Please see the output below: $ ./a.sh ./a.sh: 3: ./a.sh: Host: not found ./a.sh: 4: ./a.sh: Port: not found Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] [-m mark] [-M
If you ever got to execute this line, you'd see an error bash: fi: command not found.
How could I have modern computers without GUIs? In our first try (when number=1), the shell substituted 1 for $number like so: if [ 1 = "1" ]; then However, when we set number to nothing (number=), the shell Browse other questions tagged bash shell-script or ask your own question. Syntax Error Near Unexpected Token `done' And yes it's what I want the script to do, not to get the present time + 10sc.
This is one reason you should test your scripts frequently when you are writing them so there is less new code to test. I am confused, I have an if statement at last and it looks correct! Linux Forum XenForo style by Pixel Exit check over here Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?
It's most probably missing fi or } somewhere, but without indentation you won't ever see where. –Jan Hudec Mar 27 '12 at 9:17 What is the assignment to value Use set -x to turn tracing on and set +x to turn tracing off. I agree with camh, that correct indentation from the beginning helps to avoid such errors. I mean, If I put the number 13 it just ends, it doesn't say "Creo que esto ya no es un mes!" –Divshah Sep 12 '14 at 4:24 @Divshah: