Hi all,
Sorry for a noob question, I’m jus started with Linux today :D My droplet used CentOS 6.5. I have a script name “loop.sh” with this code:
#!/bin/bash while : do sl done
When I try to run it with command “bash loop.sh” there’s error: syntax error near unexpected token `done’.
What can I do now? Please help.
Thank you so much.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I copied and created new file with the code in example of the link: <br> <br>#!/bin/bash <br>COUNTER=0 <br>while [ $COUNTER -lt 10 ]; do <br>echo The counter is $COUNTER <br>let COUNTER=COUNTER+1 <br>done <br> <br>Nothing changed! There’s error: <br>line 6: syntax error near unexpected token `done’ <br> <br>Why bash programing is too hard???
You need a condition for the while loop. See the examples in the link I gave you above. <br>
I replaced : with ; then got another error <br>syntax error near unexpected token `;’
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.