Running a .bash file in Eclipse

14,233

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

Share:
14,233

Related videos on Youtube

Anne Ambe
Author by

Anne Ambe

Updated on September 18, 2022

Comments

  • Anne Ambe
    Anne Ambe over 1 year

    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.

  • steeldriver
    steeldriver over 9 years
    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).