Home > Syntax Error > Syntax Error Word Unexpected (expecting ) ) Shell Script

Syntax Error Word Unexpected (expecting ) ) Shell Script

Contents

If you want to know what's going on inside of there do: sh -vx /path/to/script –mikeserv Apr 23 '14 at 12:26 @Timo The script pasted in your question seems Reportremoval.sh: 5: Syntax error: word unexpected (expecting "do") Please give me some suggestion. Should a country name in a country selection list be the country's local name? the sum of consecutive odd numbers Add a language to a polyglot Joining two lists with relational operators Is there any financial benefit to being paid bi-weekly over monthly? his comment is here

Not the answer you're looking for? But this script: #!/bin/bash for i in `seq 1 5`; do echo $i done ...outputs this error: Syntax error: end of file unexpected (expecting "done") Is there something wrong with that You have two options to make sure the script is interpreted by bash: Move the shebang to the first line Run sudo like this: sudo bash ./pi_dev_env_install.sh share|improve this answer answered It is absolutely necessary. –kingneil Jan 12 at 8:45 | show 5 more comments Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign

Syntax Error Word Unexpected (expecting ) ) Shell Script

Adding the shebang line solved it immediately. +1. –bkd.online Oct 9 '13 at 5:14 Facing the issue running sonarqube.sh on Ubuntu 15.10. share|improve this answer answered Apr 3 '14 at 22:13 rici 106k1183140 i am trying this now –Undermine2k Apr 3 '14 at 22:24 So this fixed the other The sequence of \r \n characters, which is repeated several times, shows that this file has DOS/Windows line endings. So even if the script successfully started at some point in your testing, it would have aborted once line 68 was reached.

asked 4 years ago viewed 113229 times active 1 year ago Related 2Shell script error message1/shell-script: syntax error near unexpected token `done'4Shell Script - syntax error near unexpected token `else'0Shell script How can I stun or hold the whole party? Why does Davy Jones not want his heart around him? Syntax Error Unexpected Word Expecting How could I have modern computers without GUIs?

more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation The situation is: Me having a UPS and wanting to get a script which shuts down my VM's and afterwards shuts down the Host if the UPS starts running. How do I reassure myself that I am a worthy candidate for a tenure-track position, when department would likely have interviewed me even if I wasn't? Unix & Linux Stack Exchange works best with JavaScript enabled current community chat Unix & Linux Unix & Linux Meta your communities Sign up or log in to customize your list.

Unix & Linux Stack Exchange works best with JavaScript enabled Dos2unix Just put it inside [code] and [/code] tags Adv Reply April 21st, 2009 #4 rohandeshmukh View Profile View Forum Posts Private Message First Cup of Ubuntu Join Date Apr 2009 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 Getting: Syntax error: word unexpected (expecting "do")..Plz help Rohan Deshmukh asked Apr 21, 2009 | Replies (1) The code snippet is as follows: Code: #!/bin/sh path="/home/directory/Reports" echo "The reports older than

Syntax Error Word Unexpected (expecting ) ) Ubuntu

Linked 0 Syntax error: end of file unexpected (expecting “do”) Related 2211Check if a directory exists in a shell script3004Getting the Current/Present working directory of a Bash script from within the Make up your mind. Syntax Error Word Unexpected (expecting ) ) Shell Script share|improve this answer answered Aug 18 '12 at 12:08 Gilles 382k727031146 1 Thanks clearly a gap in my knowledge, I don't script much so wasn't aware of that! Unexpected Expecting Done What does "put on one's hat" mean?

You're now being signed in. this content 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 How many times do you need to beat mom and Satan etc to 100% the game? rather than dbuser=$DROPBOX_USERS share|improve this answer edited Apr 6 '14 at 10:47 answered Apr 6 '14 at 10:41 Michael Tomkins 745 Downvote for patronizing people who have a different Syntax Error Done Unexpected

current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. WAIT_TRYS=20 # how long to wait in seconds each time for a VM to shutdown. asked 5 years ago viewed 11675 times active 3 years ago Get the weekly newsletter! http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-shell-script.html Eating Skittles Like a Normal Person Joining two lists with relational operators Secret salts; why do they slow down attacker more than they do me?

share|improve this answer answered Sep 3 '13 at 8:42 Frantique 5,5461637 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign While Loop Bash Anxious about riding in traffic after 20 year absence from cycling Complimenting the author of a textbook Will a tourist have any trouble getting money from an ATM India because of Try: hexdump -C yourscript.sh And look for 0d 0a sequences.

Letter of Recommendation Without Contact from the Student Square root image filter tool in Python TV episode or movie where people on planet only live a hundred days and fall asleep

beat me to it. ;) –jwir3 Mar 30 '11 at 20:08 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up vote 3 down vote favorite I can't normally run sh scripts. More Linux Groups Your account is ready. asked 2 years ago viewed 7277 times active 2 years ago Get the weekly newsletter!

Word that includes "food, alcoholic drinks, and non-alcoholic drinks"? If you are uploading the script to your linux/unix box via FTP, you can select ascii/text format, and FTP will handle the end of line conversion for you. There is nothing about this line running as sudo that should stop it working to my knowledge, does anyone have any ideas? check over here Any other info you can give us when your first one fails? –Dan Kendall Mar 30 '11 at 20:08 add a comment| 2 Answers 2 active oldest votes up vote 10

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 command-line bash scripts share|improve this question edited Sep 3 '13 at 21:57 Braiam 39.9k1694156 asked Sep 3 '13 at 8:29 user568021 3002619 How do you run the above script? if [ $STATUS -ne 0 ]; then if [ $TRY -lt $WAIT_TRYS ]; then # if the vm is not off, wait for it to shut down TRY=$((TRY + 1)) echo Only got the error message when I separated the commands: $ sudo sh # ./install hope it helps share|improve this answer answered Nov 27 '15 at 22:00 user145114 1

Browse other questions tagged shell-script ssh shutdown or ask your own question. Executing sudo sh ./sonar.sh console. Try entering it through vi, as it may end up being some character encoding / line feeds in your script. –dotalchemy Mar 30 '11 at 20:06 Weirdly your first Deep theorem with trivial proof Remnants of the dual number Am I being a "mean" instructor, denying an extension on a take home exam Does using documentation as a developer make

Browse other questions tagged shell syntax sh nohup or ask your own question. 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 All rights reserved. I set the permissions to 777 and +x so it should work with the 'sh' command, right...

shell syntax sh nohup share|improve this question edited Jan 12 at 8:31 Alex Andrei 5,53021232 asked Jan 12 at 8:15 kingneil 153 Do you want an infinit loop? –Frank French vs Italian resistance Positivity of certain Fourier transform What does "put on one's hat" mean? What mechanical effects would the common cold have? In it, you'll get: The week's top questions and answers Important community announcements Questions that need answers see an example newsletter By subscribing, you agree to the privacy policy and terms

Does using documentation as a developer make me look unprofessional? Mar 30 '11 at 21:28 add a comment| up vote 0 down vote Give this a try: #!/bin/sh while [ true ] do echo "WTF" done Please pay special attention to When you type it in the shell it adds them automatically, so put them after the "echo" and "rm" lines. Edit: It also occurred to me that this could be made much easier - find has a delete option: Code: find $path/*.xls -mtime +1 -delete Adv Reply April 21st, 2009

Will a tourist have any trouble getting money from an ATM India because of demonetization? Not the answer you're looking for?