LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 06-06-2012, 07:48 AM   #1
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Rep: Reputation: 21
SHELL related question?


Hi All,
This may be very basic but still want to know how does this work.My requirement is to add a directory say /home/abc to my PATH variable for user xyz.Now I have read on the internet that the best way is to edit the .bash_profile file for the same.I am using ksh but.So the question is do I have to add multiple .*sh_profile files if I am using multiple shells.Also to have the same PATH work for all the shells do I have to add the PATH variable in all the profile files.Also my basic question to add the directory to the path variable.Do I have to add the following entry in the profile file

PATH=$PATH:/data/myscripts and thats it.

Please let me know.

Thanks.
 
Old 06-06-2012, 08:28 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,577
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
ksh is Korn shell so it relies on .profile not .bash_profile or .bashrc which are designed for bash (Borne Again Shell) which can also use .profile. csh (C shell) instead relies on .tcshrc. Each shell may have its own files so it is best to review the man page for the shell you intend to use. (i.e. type "man ksh" for manual page about ksh.)

Note that dot files such as .profile and .bash_profile are in the user's home directory so are unique to each user. If you want do environmental settings/variables for all users using a given shell then you'd edit files in /etc (e.g. /etc/profile for ksh and bash or /etc/csh.cshrc for csh)

Yes adding the PATH as you have it should work. Note that order of directories in PATH variable is important. If for example you had a program with the same name but different functions in each of /bin, /usr/bin and /data/myscripts and echo $PATH displayed:
/bin:/usr/bin:/data/myscripts
It would always run the one in /bin as that was first in your PATH. On the other hand if you had:
/usr/bin:/bin:/data/myscripts
It would always run the one in /usr/bin first.

Usually the above isn't an issue but you need to be aware of it. For example many DB products provide "isql" so it would be important that a DB user for one DB type use the isql provided by that product rather than one for another if you happened to be running more than one DB type on the same server.
 
1 members found this post helpful.
Old 06-06-2012, 09:25 AM   #3
Ajit Gunge
Member
 
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Blog Entries: 1

Original Poster
Rep: Reputation: 21
Thanks for your inputs.
 
  


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
issue related to shell script manglesh.vyas Linux - Newbie 2 12-07-2010 06:39 PM
shell script related to square of number question studywell09 Programming 6 02-07-2010 03:32 PM
Related to shell scripting ravidangaych Linux - General 15 11-05-2009 10:08 AM
shell script (bind related) OTIM Programming 6 07-10-2008 05:26 PM
shell related query !!!!!!!!!!! iacharyya Linux - General 10 06-09-2008 07:39 PM


All times are GMT -5. The time now is 10:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration