I'm trying to run a program defined in an alias (and the alias is defined in a source file)

alias myapp="/somepath/app -arg1 -arg2"

Then I go to IDEA and create an External Tool

Program: Bash
Arguments: -c "source /filewithalias.sh && myapp" 

Then when I run, I get the following message:

bash: myapp: command not found


I already tried prepending

shopt -s expand_aliases

To the command string but the result is still the same


The reason of your failure is that myapp is evaluated by bash at the time of the line evaluation, i.e. before its definition. I suggest you to avoid aliases for this purpose (I can't find any easy method with aliases).

Here is a simple method. If you don't have already one, create a personnal directory for all your binaries and shell scripts:

$ mkdir ~/bin

Add this new directory within your shell standard PATH:

export PATH

Create a new shell script to fire your application with all the required arguments:

$ cd ~/bin
$ cat >myapp.sh <<eof
/somepath/app -arg1 -arg2
$ make myapp

check that it is working from your actual environment:

$ myapp

Then call it from IDEA:

Program: myapp

check that it is working from within IDEA.

You must log in to answer this question.

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