Linux Shell Script Syntax Error Unexpected End Of File
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 bash unexpected end of file while looking for matching ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & syntax error unexpected end of input 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 shell script validator 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 Syntax Error: unexpected end of file — Bash script [closed] up vote 0 down vote favorite
Syntax Error Near Unexpected Token `fi'
1 I am trying to create an spritz app. 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. I am confused, I have an if statement at last and it looks correct! Here is the last portion: #checks if speed is 150 157 if [[ $2 -eq 150 ]]; 158 then 159 starttime=$SECONDS 160 FS=$'\n' 161 for j in `grep --color=always -iP syntax error near unexpected token `done' '\b[^aeiou\s]*[aeiou][^aeiou\s]*\K[aeiou]' $1`; 162 do 163 #Reads the text file in the centre of the screen 164 echo " ___________________" 165 echo " $j"; 166 echo " ___________________" 167 echo " Speed 150 wpm" 168 sleep 0.9; 169 clear; 170 done 171 endtime=$(($SECONDS - $starttime)) 172 echo "You read $words_read words in $endtime seconds!" 173 exit 8 174 fi bash shell-script share|improve this question edited Mar 29 '15 at 5:19 Anthon 47.6k1462125 asked Mar 29 '15 at 1:31 Scott Pearce 46117 closed as unclear what you're asking by mdpc, jasonwryan, Networker, Michael Homer, Archemar Mar 29 '15 at 8:23 Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question. (0) It might have been more useful to show us a diff from the last version that worked. … … … … … … … … Some observations (that probably don’t relate to your current, specific problem): (1) I don’t know of any circumstance where you need an unescaped ; (semicolon) at the end of a line. You can delete the semicolons at the ends of lines 157, 161, 165, 168, and 169. (Or you can leave them in; I guess it’s a question of style.) … (Cont’d) –Scott Mar 29 '15 at 7:
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 with us Unix & Linux Questions Tags Users integer expression expected Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users
Syntax Error Unexpected End Of File Python
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
Unary Operator Expected Bash
answer The best answers are voted up and rise to the top Got “syntax error near unexpected end of file” in bash script up vote 0 down vote favorite 2 I'm making an script that gives me a day like this jjj/yyyy when I give it a http://unix.stackexchange.com/questions/193165/syntax-error-unexpected-end-of-file-bash-script day like this dd/mm/yyyy and I need it to have an error when you don't write correctly but I'm starting and it's not working :( #! /bin/bash #Primero debes ingresar el mes echo "Ingresa el número de un mes del año" read mes #Condicional #Dependiendo si coloca bien $mes if [ "$mes" -lt 12 -a "$mes" -gt 0 ]; then echo "muy bien, sigamos." else if [ "$mes" -gt 12 -a "$mes" -lt 0 ]; then echo "Creo que eso ya no es un mes!"; exit fi When I run it it says http://unix.stackexchange.com/questions/155166/got-syntax-error-near-unexpected-end-of-file-in-bash-script "syntax error near unexpected end of file" Can anyone help me? bash shell scripting share|improve this question edited Sep 12 '14 at 3:59 cuonglm 72k13116200 asked Sep 12 '14 at 3:59 Divshah 1113 Yes, someone can help you. –Anthon Sep 12 '14 at 4:05 Your code doesn't make sense. A number cannot be at the same time less than 0 and greater than 12, so your second condition can never be true. Also note that -lt and -gt are for strictly greater. -lt 12 and -gt 0 means from 1 to 11. Use -le for less than or equal. –Stéphane Chazelas Jul 28 at 7:33 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote You missed a fi for inner if: if [ "$mes" -lt 12 -a "$mes" -gt 0 ]; then echo "muy bien, sigamos." else if [ "$mes" -gt 12 -a "$mes" -lt 0 ]; then echo "Creo que eso ya no es un mes!" # Missed fi here fi exit fi share|improve this answer edited Dec 16 '14 at 10:34 answered Sep 12 '14 at 4:03 cuonglm 72k13116200 Thanks! That worked. –Divshah Sep 12 '14 at 4:23 Now I have another issue, it doesn't display the second if part... 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: 13 is not greater than 12 and less than 1 –cuonglm Sep 12 '14 at 4:26 @Divshah, change your -a flag in the second if loop to -o.
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 http://www.linuxquestions.org/questions/programming-9/shell-scripting-syntax-error-unexpected-end-of-file-804990/ be directly related to Linux and any language is fair game. Notices Welcome to LinuxQuestions.org, http://askubuntu.com/questions/485567/unexpected-end-of-file 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 syntax error 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 unexpected end of 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 majorly and still get the same error so there's obviously something wrong with my basic syntax. #usr/bin/sh if [$1 -lt $2]; then echo "done" else echo "nope" fi Thanks roxie600 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by roxie600 04-29-2010, 10:35 AM #2 deadeyes Member Registered: Aug 2006 Posts: 609 Rep: Quote: Originally Posted by roxie600 hey I am very n
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 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 with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 up vote 4 down vote favorite Can someone explain why the end of the file is unexpected on line 49? (Line 49 is one line after the last line) #!/bin/bash timeend=$(date -u +%H%M) timestart=$(date --date "$timeend 30 minutes ago" -u +%H%M) firsttime=0 while true do if [[ $firsttime -eq 0 ]]; then time=$timestart increment=0 fi if [[ $firsttime -ne true ]]; then increment=$(( $increment + 2 )) time=$(( $timestart + $increment )) fi if [[ $time -ge $timeend ]]; then break fi gpnids << EOF RADFIL = NEXRIII|CLT|TR0 RADTIM = "$time" TITLE = 1/-2 PANEL = 0 DEVICE = gif|radar"$increment".gif|1280;1024|C CLEAR = Y TEXT = 1/2/2/hw COLORS = 7 WIND = LINE = CLRBAR = IMCBAR = 5/v/LL/.005;.6/.4;.01 GAREA = dset MAP = 24 + 23 + 1/1/2 + 14 + 15/1/2 LATLON = 0 OUTPUT = t $mapfil = lorvus.usg + hicnus.nws + hipona.nws + louhus.nws + loisus.nws run exit EOF firsttime=1 gpend done bash share|improve this question asked Jun 19 '14 at 16:11 WxPilot 1681215 This question might be better asked on 'code review', another stack exchange site. –Charles Green Jun 19 '14 at 16:19 Thanks for the tip, I added that site to my favorites and will turn to it for future scripting issues unless they might benefit the general user. –WxPilot Jun 19 '14 at 16:25 @CharlesGreen No way. CR says clearly: "However, if your question is ... about ... Trouble-shooting, debugging, or understanding code snippets ... then your question is off-topic for this site". Btw., CR is a young beta site with hardly anyone wasting their time there. –maaartinus Jun 19 '14 at 19:38 @maaartinus Crud - I thought since it said 'peer review' that it would be filled with people trying to figure out how to write code effectively. How about 'stack overflow'? –Charles Green Jun 19 '14 at 22:00 1 @CharlesGreen It's just about improving code and code style, definitely not about finding bugs. SO or Lin