LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding path from root directory (https://www.linuxquestions.org/questions/linux-newbie-8/adding-path-from-root-directory-4175483621/)

sawdusted 11-06-2013 12:47 PM

Adding path from root directory
 
Guys, I want to try to add a path to my .bash_profile which originates from my root directory. How do I do that?

Path I want to add:
/root/opt/local/bowtie/

Current .bash_profile code:
Code:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

if [ ! -f $HOME/.ssh/id_rsa ] ; then
        /opt/bin/pssc-config-sshkeys
fi

I added on this code for the path at the end:
Code:


# Addition of bowtie path

PATH=$PATH:/opt/local/bowtie

export PATH

fi

But it gave a syntax error. Hope someone can help solve this.

Thanks.

andrewthomas 11-06-2013 01:01 PM

Quote:

Originally Posted by sawdusted (Post 5059537)

fi
[/code]

But it gave a syntax error. Hope someone can help solve this.

Thanks.

fi with no if

Just add the directory to the original $PATH line
Code:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
PATH=$PATH:/opt/local/bowtie
export PATH

if [ ! -f $HOME/.ssh/id_rsa ] ; then
        /opt/bin/pssc-config-sshkeys
fi


suicidaleggroll 11-06-2013 01:05 PM

I thought you said the directory was /root/opt/local/bowtie?

Code:

/root/opt/local/bowtie
and
Code:

/opt/local/bowtie
are not the same directory.

sawdusted 11-06-2013 01:33 PM

yes it is in the root directory. Will make the changes and let you know.

Thanks.

sawdusted 11-06-2013 01:55 PM

Solved. Thanks guys!

andrewthomas 11-06-2013 07:09 PM

You're welcome. Glad to be of help.


All times are GMT -5. The time now is 07:07 PM.