Home > Syntax Error > Bin/sh Array Syntax Error Unexpected

Bin/sh Array Syntax Error Unexpected

Contents

Modern soldiers carry axes instead of combat knives. If not, why? 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 cheers –IGGt Jan 7 at 15:24 That's not necessarily, but there must be coordination between #!/bin/sh and sh script.sh (or #!/bin/bash and bash script.sh) –Konstantin Morenko Jan 7 at check my blog

Inverted question mark, plus its gender Dennis numbers 2.0 In a GNU C macro envSet(name), what does (void) "" name mean? I will stick to using ./ from now on. My Ubuntu version is: Ubuntu 14.04 arrays bash shell ubuntu share|improve this question edited Aug 9 '14 at 19:46 asked Aug 9 '14 at 19:29 Mistu4u 1,46662352 sh array.sh You should be able to run your bash scripts with the bash command even if your default shell is i.e.

Bin Sh 1 Syntax Error Unexpected

Is that my syntax is wrong, or my sh shell version too old, or sh shell do not support array command, only bash shell support it ? $ myarray=(a b c) Join them; it only takes a minute: Sign up Why is my array incorrect for my shell script? If we have two functions that have composition differentiable does it mean both are differentiable? 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

[email protected]:~/Desktop$ ls -l /bin/*sh -rwxr-xr-x 1 root root 676836 2006-09-19 15:24 /bin/bash -rwxr-xr-x 1 root root 79912 2006-07-11 12:31 /bin/dash lrwxrwxrwx 1 root root 4 2007-05-13 09:13 /bin/rbash -> bash lrwxrwxrwx When I executed it as ./test.sh it worked fine! –user1357576 Jun 14 '12 at 3:50 Ah yes, sh is not alway 'sh'. Mass replace names in vertex groups Will the medium be able to last 100 years? Bash Function Syntax Error Unexpected Powered by vBulletin Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc.

How to book a flight if my passport doesn't state my gender? Bin Sh C Line 0 Syntax Error Near Unexpected Token Also I have tried by executing bash array.sh but no luck! Modern soldiers carry axes instead of combat knives. 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.

Dennis numbers 2.0 How to deal with a very weak student? Syntax Error Unexpected Array Php QuikeeMay 15th, 2007, 02:27 PMI did my own example and "a=( a b c )" works for me.. But when you use sh scriptname.sh it executes sh, not bash. All rights reserved.

Bin Sh C Line 0 Syntax Error Near Unexpected Token

What aircraft would have these tail numbers? I strongly suspect you did something else that fixed the problem. –Keith Thompson Aug 9 '14 at 20:15 add a comment| Your Answer draft saved draft discarded Sign up or Bin Sh 1 Syntax Error Unexpected thank you everyone... Bash Array Syntax Error Near Unexpected Token Browse other questions tagged arrays bash sh or ask your own question.

Please explain the local library system in London, England Why don't most major game engines use gifs for animated textures? http://onlinetvsoftware.net/syntax-error/bash-array-syntax-error-unexpected-expecting.php The shell used to execute a script is not affected by which shell you're currently using or by which shell is configured as your login shell in /etc/passwd or equivalent (unless Browse other questions tagged bash or ask your own question. Why doesn't work as an external file? –Michael S. Syntax Error Unexpected In Shell Script

share|improve this answer answered Aug 9 '14 at 20:00 Mistu4u 1,46662352 3 Strange. Send to Email Address Your Name Your Email Address Cancel Post was not sent - check your email addresses! How to book a flight if my passport doesn't state my gender? news Just because you don't use it directly doesn't mean that there aren't any shell scripts on your system that rely on "/bin/sh" to behave like dash rather than bash.

Main Menu LQ Calendar LQ Rules LQ Sitemap Site FAQ View New Posts View Latest Posts Zero Reply Threads LQ Wiki Most Wanted Jeremy's Blog Report LQ Bug Syndicate Latest Bash Syntax Error Near Unexpected Token Lloyd B. Not the answer you're looking for?

The solution below works. –geotheory May 3 at 12:54 bash or sh best for cron? –geotheory May 3 at 12:54 1 @geotheory it really depends on what you

Join them; it only takes a minute: Sign up Error 'Syntax error: “(” unexpected' when declaring arrays in bash up vote 0 down vote favorite Same problem as this OP, but Was Donald Trump's father a member of the KKK? 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. Bash Script Array Join our community today!

If we have two functions that have composition differentiable does it mean both are differentiable? Does an Ebonblade Reaper holding a Quietus Spike kill players? Do this correctly mywiki.wooledge.org/BashFAQ/001 . More about the author Inverted question mark, plus its gender Yes, of course I'm an adult!

I know the script works, so it must be some kind of quirk with something else. –Michael S. I am creating a shell script. This is my first time in shell programming so I am unable to fix the issues myself. If you need arrays, then Bash. –fedorqui May 3 at 12:54 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted Specify your interpreter explicitly in

The time now is 06:06 AM. If you execute it by typing something like: sh ./array.sh then it will execute it using /bin/sh. 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. GTIN validation How would family relationships change if legal system uses collective punishment?

I was executing it as sh test.sh and then it was throwing the error. If you want to make that an answer, I can accept. One possibility: Could you cut and paste the exact error message you're getting? If you execute the script by typing ./array.sh the system will pay attention to the #!/bin/bash line and execute the script using /bin/bash.

When was this language released? 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. command). share|improve this answer edited Jan 7 at 23:37 Gilles 369k666681119 answered Jan 7 at 15:06 Konstantin Morenko 1986 OK, that makes sense now.

I will try running the script as you did when I get home from work, and see if I get the same results. Of course, the syntax error lines kill the script, but if it's just the final space-less assignment, it works fine. –Marc B Jun 14 '12 at 3:38 1 I know printf '%q\n' "${file_list[@]}" would make sense, sure, but as it is your code only prints the first array entry, and that after string-splitting and glob-expanding it (since you don't quote correctly). bash shell-script array share|improve this question edited Jan 7 at 23:36 Gilles 369k666681119 asked Jan 7 at 14:42 IGGt 398213 Did you copy-pasted the script between the two server?

So the issue is that running a shell script as "sh {script}" or "dash {script}" bypasses the "#!/bin/bash" line, thus causing it to fail. chrism01 View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by chrism01 05-22-2008, 10:41 PM #4 konsolebox Senior Member Registered: Oct 2005 Distribution: But when I run this on the other server I get: Syntax error: "(" unexpected As far as I can tell both servers are the same.