share|improve this answer answered Mar 27 '12 at 9:24 ams 15.3k22655 add a comment| up vote 1 down vote I had this problem when running some script in cygwin. Are you new to LinuxQuestions.org? 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 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 have a peek here
That's now working fine. Try changing it to #!/bin/bash catkin View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by catkin View Blog 04-29-2010, 12:43 PM #7 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 It is useful to know that program flow is happening the way we expect.
Set "execute" permissions (by running "chmod +rx tmp.sh") 5. asked 4 years ago viewed 14026 times active 4 years ago Related 0Bash script throws “syntax error near unexpected token `}'” when run0line 45 Syntax error: unexpected end of file0Syntax Error: Skeletal formula for carbon with two double bonds Plot of the image of a circle by some functions Does the verb 'to busy' require a reflexive pronoun?
There are two kinds of messages that you should insert. It should be: install: myapp @if [ -d $(INSTDIR) ]; \ then \ cp myapp $(INSTDIR);\ chmod a+x $(INSTDIR)/myapp;\ chmod og-w $(INSTDIR)/myapp;\ echo "Installed in $(INSTDIR)";\ else\ echo "Sorry, $(INSTDIR) does You can easily confirm this is with a simple example: # #!/bin/bash offfset=(`ls`) echo $offset Running this script with sudo will raise a syntax error in recent versions of Ubuntu and Syntax Error Unexpected End Of File In Linux asked 3 years ago viewed 6094 times active 3 years ago Related 7Syntax error : end of file unexpected (expecting “fi”)85Makefiles with source files in different directories1Undefined reference error in a
Not the answer you're looking for? Syntax Error End Of File Unexpected (expecting Fi ) My girlfriend has mentioned disowning her 14 y/o transgender daughter How to map and sum a list fast? Consider what happens if a variable is set to equal nothing. Use echo commands to verify your assumptions.
asked 3 years ago viewed 15814 times active 3 years ago Related 6How do the environments of a standard Terminal command-line and a bash script differ?0Why does this script work in Syntax Error Unexpected End Of File In Unix Shell Script Skeletal formula for carbon with two double bonds Can filling up a 75 gallon water heater tank without opening a faucet cause damage? These errors can be a real pain to find in a long script. Try to move the shebang in line 1. –manatwork Aug 18 '12 at 11:45 According to that article calling /bin/bash directly instead of /bin/sh will; correctly use bash instead
Not the answer you're looking for? Now I know my ABCs, won't you come and golf with me? Bin Sh C Line 1 Syntax Error Unexpected End Of File But interestingly, on the correct arch the file beginning with #! /bin/sh executed perfectly. Syntax Error End Of File Unexpected (expecting Done ) You seem to be looking for date +%T -d 'now + 10 seconds'.
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 navigate here This site is not affiliated with Linus Torvalds or The Open Group in any way. On THE other hand or on another hand? How to map and sum a list fast? Syntax Error End Of File Unexpected (expecting Then )
Can filling up a 75 gallon water heater tank without opening a faucet cause damage? 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" Changed the header as said. Check This Out What does an 'ü' mean?
Shotts, Jr. Syntax Error Unexpected End Of File In Php Skipping directly to level 4 Subtraction with a negative result Which requires more energy: walking 1 km or cycling 1 km at the same speed? The shebang line must be the very first thing in the file.
If that's the case dos2ux should fix that. 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 Video displays in Star Wars My girlfriend has mentioned disowning her 14 y/o transgender daughter I accepted a counter offer and regret it: can I go back and contact the previous this contact form Obviously, it's more different then coding then I thought.
Problem? And at least 4 spaces per indentation level at that, so you can really see the structure. Normally you need spaces between the if and brackets, ... Join them; it only takes a minute: Sign up Shell Script Syntax Error: Unexpected End of File up vote 8 down vote favorite 2 In the following script I get an
To post code or command output, use [code] tags.