Question

I'd like to begin with clojure and I'm trying to install Leiningen (I'm running Ubuntu). I downloaded the file and saved it to ~/Code/lein.sh What's the proper way to add this to my .bashrc file? Does the name I chose (lein.sh) matter?

The end of my .bashrc looks like this:

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

### Java
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386

### Android
#~ export PATH=~/Code/adt-bundle-linux-x86-20131030/sdk/tools
#~ export PATH=~/Code/adt-bundle-linux-x86-20131030/sdk/platform-tools
export ANDROID_HOME=~/Code/adt-bundle-linux-x86-20131030/sdk/tools
export ANDROID_PLATFORM_TOOLS=~/Code/adt-bundle-linux-x86-20131030/sdk/platform-tools
export PATH=$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

What's the proper way to add ~/Code/lein.sh to my path using .bashrc?

Was it helpful?

Solution

Two ways. The first, and recommended, way is not to change your .bashrc at all, but move lein.sh to a directory where your shell can find it when it's looking for executables. ~/bin/ or /usr/local/bin are the most obvious candidates. Type echo $PATH in your terminal to find out which directories are currently on your shells PATH.

If you insist on keeping lein.sh in its current location, you can extend the PATH list to include the ~/Code directory. Examples of extending PATH are already in the bits of .bashrc you quoted, just follow the pattern:

export PATH=$PATH:$HOME/Code

This will make everything in ~/Code a candidate for an executable, regardless of your current working directory. It is not generally good practice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top