Home > Syntax Error > Bash While Loop Syntax Error

Bash While Loop Syntax Error

Contents

How to map and sum a list fast? The users who voted to close gave this specific reason:"This question was caused by a problem that can no longer be reproduced or a simple typographical error. Please explain the local library system in London, England Convince people not to share their password with trusted others How to make different social classes look quite different? while [ $i -lt $p ] || [ $i -eq $p ]; do The less-than-or-equal operator is -le instead of doing two tests. http://gatoisland.com/syntax-error/bash-for-loop-syntax-error.php

Thank you so much. Maybe some good Samaritan will try to help you. Also, you should start indenting nested commands and get your do on the same line as the while for readability. if [ "${counter}" == "true" ] ; then ^ 2) You are not closing the if with "fi" here.

Bash While No Error

Reminds me of the old newbie jokes with ctl-alt-del. Forum Operations by The UNIX and Linux Forums Were slings used for throwing hand grenades?

What can I do now? My script is like: #!/bin/sh FILENAME=$1 while read line do if [[$line = *sometext*]] then echo $line fi done < $FILENAME And I get the error: line 5: syntax error near Why are some programming languages Turing complete but lack some abilities of other languages? Bash Syntax Error Near Unexpected Token Done' How to deal with a very weak student?

restarting..."; sleep 5; done share|improve this answer answered Jul 26 at 13:38 Pietro 845515 tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html –Pietro Jul 26 at 13:40 3 There is nothing wrong with putting do Bash While 1 100 I see that you have run the file through dos2unix but I would still recommend you run it through something similar once more: tr -d '\015' < src.sh > dst.sh share|improve Bash is expecting a fi before the while's done. User Information" echo "2.

Maybe get rid of the semicolon after done and see if that helps. –Juan Tomas Jul 26 at 13:41 Can reproduce this. Bash Syntax Error Near Unexpected Token Else' Why don't most major game engines use gifs for animated textures? I used a while loop to make the script run forever (until Ctrl+C), but the while loop doesn't seem to work. How to increase the population growth of the human race I do not get any ether when mining no outgoing connection via ipv4 Skeletal formula for carbon with two double bonds

Bash While 1 100

What does the "Phi" sign stand for in musical notation? I'm writing a script that uses a while loop to ask what text file to write to if you decide not to overwrite an existing file, among other things. Bash While No Error 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 Android Shell Script Syntax Error Do Password Home Search Forums Register Forum RulesMan PagesUnix Commands Linux Commands FAQ Members Today's Posts Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK

Last edited by vgersh99; 03-25-2009 at 03:58 PM.. Remove advertisements Sponsored Links warlock129 View Public Profile Find all posts by warlock129 #2 03-25-2009 vgersh99 Forum http://gatoisland.com/syntax-error/bash-for-loop-syntax-error-unexpected-end-of-file.php Disk Usage" echo "3. At first I didn't remember –DonCallisto May 28 '12 at 8:26 ok thanks DonCallisto –jarhead May 28 '12 at 8:27 add a comment| up vote -2 down vote I Why write an entire bash script in functions? Python While Loop Syntax Error

As a general suggestion, it's better to use shell built-in[[ ... ]] over the test [ ... ] in bash. Reply Log In to Comment 0 dinhhoangviet May 18, 2014 I copied and created new file with the code in example of the link: #!/bin/bash COUNTER=0 while [ $COUNTER -lt 10 Finding a file starting with '-' dash Is the standard Canon 18-55 lens the same as 5 years ago? navigate here Will the medium be able to last 100 years?

I have my share of cases where the script complain at line 150 and the problem as on a misquote in a completed different line. –BitsOfNix Aug 24 '15 at 7:25 Bash Syntax Error Near Unexpected Token Fi' Not the answer you're looking for? Is it possible to check for existence of member template just by identifier?

It looks like evn after dos2unix you have CR line endings. –muru Aug 24 '15 at 7:22 1 @Murat, just like Stephane mentioned, the problem seems to be in the

There are several blocks that would be easier to read if they were indented. –Bryan Oakley Jul 23 '15 at 19:44 1 you are missing a fi after echo "'$ff' This is impossible to read. Logged shimonl Sr. Bash Syntax Error Invalid Arithmetic Operator Limit involving exponentials and arctangent without L'Hôpital Finding a file starting with '-' dash Realism of a setting with several sapient anthropomorphic animal species How could banks with multiple branches work

share|improve this answer answered Jul 23 '15 at 19:52 P.P. 57.9k768118 add a comment| Not the answer you're looking for? Browse other questions tagged linux bash ubuntu or ask your own question. Remove advertisements Sponsored Links erenay View Public Profile Find all posts by erenay #5 04-13-2009 giannicello Registered User Join Date: Sep 2001 Last Activity: 21 August 2015, 10:59 his comment is here Skipping directly to level 4 How would family relationships change if legal system uses collective punishment?

Join them; it only takes a minute: Sign up Bash error: syntax error near unexpected token `done' up vote 0 down vote favorite I wrote a really simple file explorer using Subscribed! Oct 11 '12 at 13:39 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Skipping directly to level 4 How would family relationships change if legal system uses collective punishment?

Also next time use BB Codes when posting data/code samples - you'll increase the chances of your posts being answered - this is absolutely impossible to read/comprehend. Last Logins" echo "Q.Quit" echo "Which option do you require?" read menunumber2 case $menunumber2 in 1) awk -F: '{print $1}' /etc/passwd echo "Hit the Enter Key to continue" read junk;; 2) Yes, I'm sure.

© Copyright 2017 gatoisland.com. All rights reserved.