Home > Syntax Error > Syntax Error At Line 1 (' Unexpected In Shell Script

Syntax Error At Line 1 (' Unexpected In Shell Script


How could a language that uses a single word extremely often sustain itself? the answer has already been accepted... –Chris Maes Apr 12 '14 at 9:29 This does not provide an answer to the question. Is there a word for "timeless" that doesn't imply the passage of time? I just wish Ubuntu would join in with the industry standard way of doing things. http://fullflash.net/syntax-error/syntax-error-unexpected-in-shell-script.html

the (inexistent) problem is the 1st line in combination with Ubuntu. Any ideas? Since dash (like all other shells) is an interpreter, it won't complain until the execution reaches the problematic line. Something else might be broken, because .bashrc tries to execute when I log in and it crashes when it comes to the first command that is unique to bash (instead of http://unix.stackexchange.com/questions/45781/shell-script-fails-syntax-error-unexpected

Syntax Error At Line 1 (' Unexpected In Shell Script

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 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 The real problem is that: a) some people equate sh with bash, and b) bash does a poor job of emulating sh. I can't find the actual bash shell anywhere.

  • if you put #!/bin/bash it will run with bash, if you put #!/bin/sh it will run with dash, unless you changed /bin/sh link from dash to bash (or other) reality1011June 15th,
  • Why does Deep Space Nine spin?
  • Solutions?
  • Then I tried to rerun my original script again......
  • Modify functions in R using body, formals and environment methods Why does Wikipedia list an improper pronunciation of Esperanto?

That should solve this problem. Still getting the error. –soufrk Sep 1 at 6:58 @soufrk Is it sonarqube.sh or sonar.sh? Why is this Sudoku Skyscraper Failing? Line 1: Syntax Error: Unexpected Word (expecting ")") How to create a custom theme in SXA?

What are the German equivalents of “First World War”, “World War I”, and “WWI”? asked 2 years ago viewed 42977 times active 1 year ago Get the weekly newsletter! Why is the size of my email so much bigger than the size of its attached files? https://ubuntuforums.org/archive/index.php/t-499045.html select top 20 yyyymmdd,allocated_to_db,unused_in_db,used_in_db from space_usage_history where instname="$1" and db="$2" order by yyyymmdd desc go !

bash shell ubuntu shell-script share|improve this question edited Aug 18 '12 at 12:08 Gilles 374k706831129 asked Aug 18 '12 at 11:37 kemra102 4731613 The shebang is really in line Syntax Error At Line 1 (' Unexpected Solaris Then, when I rm bash, which is just a symlink, and then install, I get this: apt-get install bash ... share|improve this answer answered Jan 22 '13 at 22:34 mauro 11 2 The missing shebang was already accepted as the answer by the original poster. –Philipp Claßen Jan 22 '13 Number sets symbols in LaTeX Why cast an A-lister for Groot?

Syntax Error ( Unexpected Bash Array

same damn error. http://stackoverflow.com/questions/22063165/syntax-error-near-unexpected-token-in-sun-solaris-unix Was running wrong arch executable. Syntax Error At Line 1 (' Unexpected In Shell Script I didn't notice anything until I was running a script with #!/bin/sh which actually meant /bin/bash. Syntax Error ( Unexpected Ubuntu THanks for that! –lecardo May 18 '14 at 20:38 @Bobski: Consider using shellcheck.net in the future; it would have detected your problem. –mklement0 May 18 '14 at 21:09

Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... unix and linux commands - unix shell scripting syntax error check over here 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 On my local machine, and on the server, I run sh run_all_verification.sh... –Adam_G Mar 26 '15 at 19:56 2 Just never run a bash script with sh. The Solaris /bin/sh is not a POSIX shell and also does not understand the non-portable (()) syntax. Ksh Syntax Error Unexpected

share|improve this answer answered Mar 26 '15 at 19:54 that other guy 45.5k54170 I didn't realize there's a difference. Fine: Code: select "\"FREE SPACE:\", sum(curunreservedpgs(dbid,lstart,unreservedpgs)*(@@maxpagesize/(1024*1024))), \"Total Space: \", sum(size)/((1024*1024)/@@maxpagesize), \"Server Name :\", @@servername from sysusages where db_name(dbid)='$2' and [email protected] or segmap=7" Remove advertisements Sponsored Links otheus View Join them; it only takes a minute: Sign up Syntax error: “(” unexpected (expecting “done”) [duplicate] up vote 2 down vote favorite 1 This question already has an answer here: I http://fullflash.net/syntax-error/syntax-error-unexpected-end-of-file-shell-script.html WeyOhJune 11th, 2008, 08:39 PMWhat if my first line says: #!/bin/bash?

So here's your script: #!/bin/bash echo "start" for f in *.jpg do fname="${f##*/}" echo "fname is $fname" if (( fname % 2 == 1 )); then echo "removing $fname" rm -- Bash Function Syntax Error Unexpected Dealing with a nasty recruiter Is giving my girlfriend money for her mortgage closing costs and down payment considered fraud? Thanks for the explanation it's helped a lot and will be very useful to know in the future too. –kemra102 Aug 18 '12 at 12:25 Let me add that

Do pulled hair from the root grow back?

The other lesson here is that there are few reasons anymore to use sh. Another problem is that you didn't quote "$f" which might become a problem later. Due to Ubuntu's DashAsBinSh affinity I suspect your script is interpreted by dash instead of bash. Sh: 1: Syntax Error: "(" Unexpected Python Can the editor of a book add citations of individual chapters to his own citation count?

Not the answer you're looking for? Watching order for the Dan Brown films? How can I make two cutting lines close to each other? weblink The problem is not in the code you show, or you have a very screwed up ksh installed. –Jonathan Leffler Nov 29 '13 at 9:41 This is not the

This $'' syntax is explained here To make it completely perfect you should place -- before arbitrary filenames, otherwise rm might treat it as a parameter if the file name starts I wrote it on my local machine (OSX running bash 3.2), and am using it on a remote server running bash 4.2. Find all posts by otheus

Page 1 of 2 1 2 > « Previous Thread | Next Thread » Thread Tools Show Printable Version Email this Page Subscribe to this This is explained here You can use arithmetic expressions in if, so you don't have to use [ ] or [[ ]] at all in some cases.

I really appreciate the help.