5

I know this is really an Eclipse issue but I can't seem to login in their forum. I am running eclipse juno for some c/c++ development.However, I wrote a .bash script that initiate the entire program.As input argument to this script, I have a a configuration file which is one directory lower than the .bash file.

In terminal I just do:

./startenb.bash ./CONF/ANNE 

it runs just fine.

How can I configure the external tools in eclipse to take this file path as input argument?

Any help or old thread vaguely addressing this issue is highly welcome.

2 Answers 2

6

The precise answer is going to depend on what the startenb.bash file does - in particular whether it needs to be run from a particular directory relative to your eclipse project/build tree (when run in the terminal, where is ./ exactly?) but basically it should just be a matter of using the Location, Working Directory, and Arguments boxes in the 'External Tools Configurations' window.

For example, if I have a script in my ~/Documents directory that just prints its working directory and (first) argument:

#!/bin/bash

echo "current directory: $PWD"

echo "running with argument ${1:-[none]}"

then setting

eclipse screenshot

allows me to run

eclipse screenshot

3
  • Steeldriver, simply put, you are a life saver.For two days now I have been struggling with this issue.The mistake I was doing was that I wasn't putting the working directory.I didn't know what that means.Based on your explanation above, I did it this morning and it works like a charm.Thanks
    – Anne Ambe
    Aug 22, 2014 at 7:09
  • Another quick question, everything is working fine now but it doesn't recognize my breakpoint.Is there a possibility to configure the a bash script(external tool) to run in debug mode so that it take cognizance of the breakpoints?Thanks
    – Anne Ambe
    Aug 22, 2014 at 7:25
  • Sorry - I've never tried to set Eclipse breakpoints in a bash script. The best I can suggest is that you add a set -x directive to the script itself to make debugging easier (-x Print commands and their arguments as they are executed. - see help set from the bash prompt). Aug 22, 2014 at 11:46
0

If you only need to run a few commands, you don't need to write a shell script.

  1. Create a new external tool configuration
  2. Set Location to /bin/sh
  3. Set Arguments to -c "list; of; commands"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .