0

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

1 Answer 1

1

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!

Sign up to request clarification or add additional context in comments.

4 Comments

@MikaelS. Have you tried to wrap the script in a heredoc ? BTW could you provide some link(s) corresponding the the "Eclipse Target Simulator". I'm not quite sure to understand which part of Eclipse it is.
Thanks. I'll try that ASAP. The Target Simulator is part of the debug configuration when you develop Eclipse plug-ins.
@MikaelS. 'Target Simulator' is not part of the standard Eclipse plug-in development tools.
@greg-449, you are right. It's probably part of this specific plugin that I'm struggling with now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.