LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-15-2012, 09:49 AM   #1
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Rep: Reputation: 16
setting PATH variable.


I have SUSE Linux and I'm trying to set my path variable.

I have added:
Code:
PATH=$PATH:/home/mynewDirectory/
export PATH
When I echo $PATH this is now appended to the PATH variable.

I want this to remain always so I added the above to both the
Code:
/home/username/.bashrc
/home/username/.profile
But when I start up a new shell using putty I see that the PATH is not set to what I want.

Why is this??
 
Old 08-15-2012, 11:13 AM   #2
guruprasadpr
LQ Newbie
 
Registered: Aug 2012
Location: India
Posts: 2

Rep: Reputation: Disabled
Hi
It might be the case that your profile file is one of the those in which you had made entries.

Please let us know the output of this in your login shell:

Code:
echo $SHELL
Guru.
 
Old 08-15-2012, 11:34 AM   #3
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
Thanks the output is:

Quote:
/bin/bash
 
Old 08-15-2012, 11:38 AM   #4
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Do you have additional initialization files like ~/.bash_profile or ~/.bash_login?
 
Old 08-15-2012, 12:10 PM   #5
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
nope just .bash_history

Thanks
 
Old 08-15-2012, 01:27 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,602

Rep: Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648Reputation: 2648
opensuse 12.1 uses a "local" version of those files
Quote:
# /etc/profile for SuSE Linux
#
# PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
# will be lost during system upgrades. Instead use /etc/profile.local for
# your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...
so please EDIT that file and NOT this one
edit "/etc/profile.local"
the same goes for
Quote:
# /etc/bash.bashrc for SuSE Linux
#
# PLEASE DO NOT CHANGE /etc/bash.bashrc There are chances that your changes
# will be lost during system upgrades. Instead use /etc/bash.bashrc.local
# for bash or /etc/ksh.kshrc.local for ksh or /etc/zsh.zshrc.local for the
# zsh or /etc/ash.ashrc.local for the plain ash bourne shell for your local
# settings, favourite global aliases, VISUAL and EDITOR variables, etc ...
suse makes use OF TONES and TONES of scripts that will REWRITE those std files
 
Old 08-15-2012, 01:37 PM   #7
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
If you edit the files in /etc/ as John VV suggests that will apply the setting for all users.

If you just want to do it for your own usercode then make yourself a .bash_profile file and put the PATH declaration in there. Making it a per-user setting has the advantage over modifying things in /etc/ that if you back up your home directory, wipe your machine, re-install it and then copy your home directory back, you still have that setting.

This article, http://www.joshstaiger.org/archives/...rofile_vs.html amongst many others explains when .bashrc is parsed and when .bash_profile is parsed.

Last edited by arizonagroovejet; 08-15-2012 at 01:38 PM. Reason: formatting fixes
 
  


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
Setting PATH variable for new users vhn Linux - General 3 01-30-2010 08:37 AM
Setting PATH variable Aigarzs Linux - Newbie 2 02-07-2008 02:27 PM
Trouble setting PATH variable krutten1986 SUSE / openSUSE 4 09-04-2006 01:21 PM
Help setting $PATH variable Nylex Linux - General 9 08-09-2003 11:44 AM
setting path variable shahrahulb Linux - General 2 07-30-2003 08:25 PM

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

All times are GMT -5. The time now is 05:40 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
Open Source Consulting | Domain Registration