LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2013, 01:47 PM   #1
sawdusted
LQ Newbie
 
Registered: Dec 2012
Posts: 14

Rep: Reputation: Disabled
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.
 
Old 11-06-2013, 02:01 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by sawdusted View Post

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

Last edited by andrewthomas; 11-06-2013 at 02:02 PM.
 
Old 11-06-2013, 02:05 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,260

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948
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.
 
Old 11-06-2013, 02:33 PM   #4
sawdusted
LQ Newbie
 
Registered: Dec 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
yes it is in the root directory. Will make the changes and let you know.

Thanks.
 
Old 11-06-2013, 02:55 PM   #5
sawdusted
LQ Newbie
 
Registered: Dec 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Solved. Thanks guys!
 
Old 11-06-2013, 08:09 PM   #6
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
You're welcome. Glad to be of help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a directory to users path in RHEL5 h0mer0 Linux - Enterprise 3 10-29-2009 10:21 PM
adding directory to the path threaderslash Programming 1 04-02-2009 01:45 AM
Adding a directory to root's path muneer1st Linux - Newbie 6 09-08-2008 04:07 AM
Adding a directory to an existing user path alex_lev Linux - Newbie 1 11-30-2006 07:44 PM
Adding directory to $PATH uv2005 Linux - Newbie 2 03-17-2006 09:39 AM


All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration