Reputation: 1015
I have a bash script .sh
which needs to be executed as a Target Simulator in Eclipse. The problem is, if I run the script with sh run.sh
command in terminal, it throws Bad Substitution error. But it works perfectly with bash run.sh
. Apparently, Eclipse run it with sh command cause it gives the same error in console. But how can I make Eclipse to run the script with bash instead?
I'm on Ubuntu 13.10.
Upvotes: 0
Views: 703
Reputation: 52030
bash
and sh
aren't the same shell. There are many constructs valid in bash
that are not understood by sh
.
Have you provided a correct sheebang as the first line of your script?
#!/bin/bash
If so -- and if Eclipse insist on running script with sh
, you still have the option of wrap your script in a heredoc and pass it to bash explicitly:
sh$ cat run.sh
bash << EOF
#
# Here is your bash script
#
EOF
This is mostly a hack until you find how to instruct Eclipse of using the right shell. I'm sure there is a way!
Upvotes: 1