Bin/sh Syntax Error End Of File Unexpected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have bin sh c line 1 syntax error unexpected end of file Meta Discuss the workings and policies of this site About Us
Syntax Error End Of File Unexpected (expecting Fi )
Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with syntax error end of file unexpected (expecting done ) us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Syntax Error End Of File Unexpected (expecting Then )
like you, helping each other. Join them; it only takes a minute: Sign up /bin/sh: Syntax Error: end of file unexpected up vote 2 down vote favorite I am getting an error when running the following makefile with make -f makefile2 install (apart install the rest is working): all:myapp #which compiler CC = gcc #Where to syntax error unexpected end of file in linux install INSTDIR = /usr/local/bin #where are include files kept INCLUDE = . #Options for development CFLAGS = -g -Wall -ansi #Options for release # CFLAGS = -O -Wall -ansi myapp: main.o 2.o 3.o $(CC) -o myapp main.o 2.o 3.o main.o: main.c a.h $(CC) -I$(INCLUDE) $(CFLAGS) -c main.c 2.o: 2.c a.h b.h $(CC) -I$(INCLUDE) $(CFLAGS) -c 2.c 3.o: 3.c b.h c.h $(CC) -I$(INCLUDE) $(CFLAGS) -c 3.c clean: -rm main.o 2.o 3.o 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 not exist";\ fi I'm getting the following error: error /bin/sh: 7: Syntax error: end of file unexpected make: *** [install] Error 2 From what I understand it is a white space/tabulation/non unix character problem in the last lines of the makefile (after install:). But even trying to delete all spaces and replacing with tabulation I didn't manage to run the makefile properly. The code comes directly from a progr
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this
Syntax Error Unexpected End Of File In Unix Shell Script
site About Us Learn more about Stack Overflow the company Business Learn more
Syntax Error Unexpected End Of File In Php
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x syntax error unexpected end of file bash Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bash: for http://stackoverflow.com/questions/14573694/bin-sh-syntax-error-end-of-file-unexpected loop in Makefile: unexpected end of file up vote 2 down vote favorite 1 I am writing a Makefile, which will list all headers included by a.cpp, b.cpp and c.h files. However, I got the error of unexpected EOF. Similar questions are always caused by the line terminator, like they used CRLF instead of LF for an EOL. However, my Text editor was set to http://stackoverflow.com/questions/30412874/bash-for-loop-in-makefile-unexpected-end-of-file using LF and I recheck this by delete all EOL and re-added. Unfortunately, the error still remains. Here are the codes: #!/bin/bash list-header: for file in a.cpp b.cpp b.h do echo "$file includes headers: " grep -E '^#include' $file | cut -f2 done I got this error message: for file in "Bigram.cpp client.cpp Bigram.h" /bin/sh: -c: line 1: syntax error: unexpected end of file" Thanks in advance for any help. bash makefile share|improve this question asked May 23 '15 at 12:50 Baozi CAI 94 An example where the "unexpected end of file" is caused by the different EOL formats. [link]stackoverflow.com/questions/6366530/… –Baozi CAI May 23 '15 at 12:53 A Makefile is not a bash script. –chepner May 23 '15 at 13:42 add a comment| 1 Answer 1 active oldest votes up vote 4 down vote accepted First note you have to escape $ that you want the shell to see, otherwise make will expand them before calling the shell. However, your main problem is that every logical line in a make recipe is a separate shell command. So, this rule: list-header: for file in a.cpp b.cpp b.h do
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn http://unix.stackexchange.com/questions/84348/unexpected-end-of-file-error-when-executing-script more about hiring developers or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 top Unexpected end of file error syntax error when executing script up vote 0 down vote favorite Can somebody help me debug this simple script. Been trying for 2 hrs now but I cant seem to get it to work. #!/bin/bash echo "Search for MMSC or WAP connectivity errors" sftpErrorCount=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| wc -l) if [ "$sftpErrorCount" -gt 0 ] then sftpErrorDate=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | end of file grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| tail -1) echo "Error found at around $sftpErrorDate please check FTP logs" else echo "No errors found" Error when I execute the script sh test_script.sh Search for MMSC or WAP connectivity errors test_script.sh: line 14: syntax error: unexpected end of file linux bash share|improve this question asked Jul 25 '13 at 1:47 dimas 3191721 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted You need to close your if-statement with the word fi. #!/bin/bash echo "Search for MMSC or WAP connectivity errors" sftpErrorCount=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| wc -l) if [ "$sftpErrorCount" -gt 0 ] ; then sftpErrorDate=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| tail -1) echo "Error found at around $sftpErrorDate please check FTP logs" else echo "No errors found" fi # ^ This closes the block. Also note that I made a few styling changes to your script. Indentation can make bugs like these easier to find. share|improve this answer edited Jul 25 '13 at 1:59 answered Jul 25 '13 at 1:54 Evan Teitelman 13.2k43758 Thanks alot evan! I think i should rest for a bit these