Makefile /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 Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads java syntax error: end of file unexpected (expecting ")") with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the syntax error: "fi" unexpected (expecting Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute:
Aapt: Syntax Error: End Of File Unexpected (expecting ")")
Sign up Syntax error : end of file unexpected (expecting “fi”) up vote 7 down vote favorite 1 I am writing a makefile in bash and I have a target in which I try to find if a file exists and
Syntax Error Unexpected End Of File Shell Script
even though I think the syntax is correct, i still gives me an error. Here is the script that I am trying to run read: if [ -e testFile] ; then \ cat testFile\ fi I am using tabs so that is not a problem. The error is (when I type in: "make read") if [ -e testFile] ; then \ cat testFile \ fi /bin/sh: Syntax error: end of file unexpected (expecting "fi") make: *** [read] Error 2 bash makefile share|improve this syntax error unexpected end of file bash question edited Apr 24 '09 at 19:26 ephemient 118k26178303 asked Apr 19 '09 at 5:48 Jaelebi 1,46362129 add a comment| 3 Answers 3 active oldest votes up vote 11 down vote accepted Try adding a semicolon after cat testFile. For example: read: if [ -e testFile ] ; then cat testFile ; fi alternatively: read: test -r testFile && cat testFile share|improve this answer edited Mar 25 '11 at 23:42 Julien Roncaglia 12.5k13667 answered Apr 19 '09 at 6:01 jwa 16113 1 the alternate solution works but I have to use the if..then syntax. adding a semicolon does not seem to solve the issue. –Jaelebi Apr 19 '09 at 6:09 Weird. I tried it the first time with semicolon and it didnt work. th second time I ran it it worked.Thanks –Jaelebi Apr 19 '09 at 6:14 Just a note to self: I originally wrote plain multiline bash statements in the makefile, and had the same failure - and as this answer notes, the trick is to have the makefile recognize the shell command as a single line; hence I'd need both semicolon ; (to separate shell commands) and backslash `\` (to escape the subsequent newline) to get it to work... Cheers! –sdaau Aug 3 '11 at 13:33 add a comment| up vote 4 down vote I ran into the same issue. This should do it: file: @if [ -e scripts/python.exe ] ; then \ echo TRUE ; \ fi share|improve this
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
/bin/sh: 1: Syntax Error: End Of File Unexpected (expecting "then")
site About Us Learn more about Stack Overflow the company Business Learn more syntax error: end of file unexpected (expecting about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x unexpected eof while looking for matching `"' Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Shell Script http://stackoverflow.com/questions/764908/syntax-error-end-of-file-unexpected-expecting-fi Syntax Error: Unexpected End of File up vote 8 down vote favorite 2 In the following script I get an error: syntax error: unexpected end of file What is this error how can I resove it? 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 http://stackoverflow.com/questions/9886268/shell-script-syntax-error-unexpected-end-of-file 'NR > 0 { s +=$3 }; END {print s}'` disk_usage=`df -h|awk {'print $2'}|head -n3|awk 'NF{s=$0}END{print s}'` #db_connections=`mysql -uroot -pexxxxxx -s -N -e "show processlist"|wc -l` db_connections=6 cld_alert() { nwconn=$1 cpu_usage=$2 disk_usage=$3 db_connections=$4 message=$5 `touch /tmp/alert.txt && > /tmp/alert.txt` date=`date` echo -e "$date\n" > /tmp/alert.txt echo -e "$message" >> /tmp/alert.txt path="/proc/$httpd/fd/"; cd $path tfd=`ls -l|wc -l`; sfd=`ls -ltr|grep sock|wc -l`; echo "Total fds: $tfd" >> /tmp/alert.txt echo "Socket fds: $sfd" >> /tmp/alert.txt echo "Other fds: $[$tfd - $sfd]" >> /tmp/alert.txt freememory=`vmstat | awk '{if (NR == 3) print "Free Memory:"\$4}'`; echo "Free memory :$freememory" >> /tmp/alert.txt Bufferedmemory=`vmstat | awk '{if (NR == 3) print "Buffered Memory:"\$5}'`; echo "Buffered memory $Bufferedmemory" >> /tmp/alert.txt CacheMemory=`vmstat | awk '{if (NR == 3) print "Cache Memory:"\$6}'`; echo "Cache memory : $CacheMemory" >> /tmp/alert.txt sshconn=`netstat -an|grep 22|wc -l` #ssh connections httpsconn=`netstat -an|grep 443|wc -l` #https connections wwwconn=`netstat -an|grep 80|wc -l` #www connections echo "Disk usage is $disk_usage" >> /tmp/alert.txt echo "DB connections $db_connections" >> /tmp/alert.txt echo "Network connections $nwconn" >> /tmp/alert.txt echo "CPU Usage: $cpu_usage" >> /tmp/alert.txt topsnapshot=`top -n 1 -b` echo "===========================TOP COMMAND SNAPSHOT===================================================="; echo "$topsnapshot" >> /tmp/alert.txt echo"==================PS COMMAND SNAPSHOT==============================================================" entireprocesslist=`ps -ef` ech
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 more about hiring developers or posting http://stackoverflow.com/questions/18155852/syntax-error-end-of-file-unexpected-expecting-then ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the http://www.linuxquestions.org/questions/programming-9/shell-scripting-syntax-error-unexpected-end-of-file-804990/ Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax error: end of file unexpected (expecting “then”) up vote 1 down vote favorite 2 I am making this code for a minecraft server plugin updater I am a new shell scripter so I don't know alot... when syntax error I run this code I get a error: #!/bin/sh export PATH=$PATH:. #Options PLUGINDOWNLOADLINK=http://api.bukget.org/3/plugins/bukkit/$PLUGINNAME/latest/download # Plugin folder if [ -f $PWD\plugins ]; then PLUG=$PWD\plugins else PLUG=$PWD\plug-ins fi cd $PLUG if [ ! -f .\update ]; then mkdir update echo Making Directory "update".. fi # Plugins Found for i in $( ls ); do PLUGINNAME=$i done cd .\update wget $PLUGINDOWNLOADLINK # No Plugins Found if [ ! -f $PLUG ]; then echo echo echo No plugin found. echo echo echo echo Plugins can be downloaded end of file here: echo http://dev.bukkit.org/bukkit-plugins fi # stop sleep 3s exit I get this error: Syntax error: end of file unexpected (expecting "then") so I put "then" in the place it wanted me to and ran it again: it gave me this error now: Syntax error: end of file unexpected I wrote it on windows 7 notepad++ how can I fix this? linux shell unix minecraft share|improve this question edited Aug 9 '13 at 21:43 asked Aug 9 '13 at 21:22 user2649805 13115 The code you posted does not cause the error. –choroba Aug 9 '13 at 21:26 then what does? –user2649805 Aug 9 '13 at 21:27 or have you composed this script in a Windows-based editor, and then copied it you your linux server without running dos2unix myPluginScript. ? Good luck. –shellter Aug 9 '13 at 21:34 ya exept it is a pi –user2649805 Aug 9 '13 at 21:35 dos2unix does not work –user2649805 Aug 9 '13 at 21:39 | show 1 more comment 2 Answers 2 active oldest votes up vote 3 down vote accepted I have met the same problem. And the problem is the format of the file is "dos", but in linux shell requires "unix", so I install the "dos2unix" $ sudo apt-get install dos2unix or if you use emacs, you can do this: C-x RET f unix Good luck :) share|improve this answer answered Sep 1 '13 at 1:23 Ni
Tutorials/Articles Search HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] Shell Scripting "syntax error : unexpected end of file" User Name Remember Me? Password Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. 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. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 04-29-2010, 10:24 AM #1 roxie600 LQ Newbie Registered: Apr 2010 Posts: 5 Rep: Shell Scripting "syntax error : unexpected end of file" hey I am very new to shell scripting and keep getting this error message so any advice would be gladly received! I have simplified my code major