I'm getting some similar errors while running aapt from Android-Studio, Running wine via playonlinux (haven't tried normal wine yet) or when trying to install steam. Perhaps with other programs as well, though I haven't tested them all.

After a bit of googling I haven't found a viable solution.

Here's an example from aapt in Android-Studio:

AAPT err(Facade for 1508687752): /home/xxx/Android/Sdk/build-tools/23.0.2/aapt: 2: /home/xxx/Android/Sdk/build-tools/23.0.2/aapt: Syntax error: newline unexpected (expecting ")")

The errors in wine and steam are similar, it's always syntax error and that it's expecting ")" or that "(" is unexpected.

I've also tested it with a script:

echo 'test'
array=(1 2 3 4 5)
echo ${array[*]}

which gives me the same error when running with sh. When I'm running it with bash or "./" it works fine.

What's the cause of this problem and what can I do to fix it?

  • Here's the result from the script: testscript.sh: 4: testscript.sh: Syntax error: "(" unexpected
    – E.J
    Feb 15, 2016 at 10:12
  • Don't run scripts with the wrong interpreter? See DashAsBinSh Feb 15, 2016 at 10:47
  • I'm starting the studio.sh from Android-Studio via ./studio.sh while I'm in the folder of it and it's still not working... Do I have to reconfigure anything for it to work?
    – E.J
    Feb 15, 2016 at 10:52

1 Answer 1


Okay, so many people don't know this, but by default Ubuntu links /bin/sh to dash, not bash. You can check this with the following:

ls -l /bin/sh

The dash shell does not support arrays as bash does as explained here.

You can check what shell you currently have open with:

echo "$SHELL"

That said, it's very odd that pre-packaged programs would be encountering that error. I would expect them to already start with #!/bin/bash if they needed it.

You can edit the scripts in question to include #!/bin/bash at the top.

If a script does not have a "shebang" line (the #! and etc. at the top) then the current shell is the default for using ./ for execution. You can change your login shell with chsh followed by your password when prompted and /bin/bash when prompted. You will have to relog.

If that doesn't help, you could also change the symlink (this probably won't break anything, but YMMV):

sudo rm /bin/sh
sudo ln -s bash /bin/sh
  • Thanks for your answer! I tried your solution and it seems to have done something, though now I get: "/home/xxx/Android/Sdk/build-tools/23.0.2/aapt: Couldn't execute the file.", [translated from german], when running aapt. Any other clue what I could do? I changed the symlink as well to bash.
    – E.J
    Feb 15, 2016 at 12:08
  • Does explicitly running /bin/bash studio.sh work?
    – TheSchwa
    Feb 15, 2016 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.