LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 12: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, 01:01 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
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 01:02 PM.
 
Old 11-06-2013, 01:05 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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, 01: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, 01:55 PM   #5
sawdusted
LQ Newbie
 
Registered: Dec 2012
Posts: 14

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

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


Reply



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 09:21 PM
adding directory to the path threaderslash Programming 1 04-02-2009 12:45 AM
Adding a directory to root's path muneer1st Linux - Newbie 6 09-08-2008 03:07 AM
Adding a directory to an existing user path alex_lev Linux - Newbie 1 11-30-2006 06:44 PM
Adding directory to $PATH uv2005 Linux - Newbie 2 03-17-2006 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Open Source Consulting | Domain Registration