Mikael S.
Mikael S.

Reputation: 1015

Set bash script in Eclipse

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.

Shot

Upvotes: 0

Views: 703

Answers (1)

Sylvain Leroux
Sylvain Leroux

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

Related Questions