Adding a path to the .bashrc file?

user1825241 picture user1825241 · Nov 29, 2012 · Viewed 83.1k times · Source

At the moment I am trying to add a path for ns-2 to my .bashrc file, I have installed the ns-allinone-2.34 but the command ns gives the result: command not found when entered into the shell.

Here is what my .bashrc file currently looks like, I edited it using gedit:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


# User specific aliases and functions
export PATH=/home/michael/ns-allinone-2.34/bin/ns:/home/michael/ns-allinone-2.34/bin/nam:$PATH

Can someone please explain why this isn't working or what a possible solution may be? I am using fedora 17.

Answer

user1830432 picture user1830432 · Nov 29, 2012

Also if you export path like this, you want to keep old PATH as well, therefore include it as well.

export PATH=$PATH:/home/michael/ns-allinone-2.34/bin/