I know there are quite some answers about that, but still could not make my way around it. I read all this and tried to follow the example under System-wide environment variables (for my case of course), and also tried to do as the chosen answer here. But didn't work.

So, I have an executable shell script, located in ~/Developer/android-studio/bin and I want to make it so that when I am in the terminal (no matter were) and I write simply android-studio and the script to be executed (the IDE to start).

So, I tried with export AS=$PATH:~/Developer/android-studio/bin and also with

export AS

and then source .bashrc, but after both tries, when I write simply AS I get command not found. How can I make this work?

Another question - is it obligatory that I name the variable with capitals only and no dashes, because I want to name the variable something like android_studio instead of AS, i.e.?

1 Answer 1


It sounds like you want to do

export PATH="$PATH:~/Developer/android-studio/bin"

Then you'll be able to enter android-studio from anywhere. There's nothing magical about an environment variable named AS

If you want a shorthand, add a function to your .bashrc:

function as() { command android-studio "$@"; }
  • Ok, let me understand this completely... With the first line PATH=... I add my directory to the $PATH env. variable, right? And then how would I denote android_studio to correspond to the added directory? (if we exclude the last line that you wrote with the function). Commented Oct 22, 2014 at 21:08
  • 1
    Once the directory is in the PATH, bash will be able to find the program "android_studio" in exactly the same way it can find the program "ls": by searching the directories in the PATH variable. Commented Oct 22, 2014 at 21:25

You must log in to answer this question.

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