- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Where is PATH variable set?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:50 PM
01-24-2005 09:50 PM
Where is PATH variable set?
Does anyone know of a tool or have a script that will tell me where all of my PATH components are set?
Thanks,
Gary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:52 PM
01-24-2005 09:52 PM
Re: Where is PATH variable set?
Your local profile then makes changes to this (as you've already seen).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:58 PM
01-24-2005 09:58 PM
Re: Where is PATH variable set?
Unfortunately, the PATH components I'm looking for are application level paths that aren't set in /etc/profile.
Thanks,
Gary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 10:03 PM
01-24-2005 10:03 PM
Re: Where is PATH variable set?
options enough:
- /etc/PATH
- modified in /etc/profile
- modified again in $HOME.profile
...
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 10:04 PM
01-24-2005 10:04 PM
Re: Where is PATH variable set?
# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH
PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/java1.4/bin
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man
# Insure PATH contains either /usr/bin or /sbin (if /usr/bin is not available).
if [ ! -d /usr/sbin ]
then
PATH=$PATH:/sbin
else if [ -r /etc/PATH ]
then
# Insure that $PATH includes /usr/bin . If /usr/bin is
# present in /etc/PATH then $PATH is set to the contents
# of /etc/PATH. Otherwise, add the contents of /etc/PATH
# to the end of the default $PATH definition above.
grep -q -e "^/usr/bin$" -e "^/usr/bin:" -e ":/usr/bin:"\
-e ":/usr/bin$" /etc/PATH
if [ $? -eq 0 ]
then
PATH=`cat /etc/PATH`
else
PATH=$PATH:`cat /etc/PATH`
fi
fi
fi
hth.
export PATH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 10:08 PM
01-24-2005 10:08 PM
Re: Where is PATH variable set?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 10:08 PM
01-24-2005 10:08 PM
Re: Where is PATH variable set?
the system PATH is set in .profile file
for any application you installed, it creates a directory /opt/
open the .profile file (using vi) and at the of PATH line add the application bin path(i.e some thing like this, PATH=/sbin:/usr/bin:/opt/
save and close the file
logout and login again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 10:26 PM
01-24-2005 10:26 PM
Re: Where is PATH variable set?
However what I was getting at was some sort of tool/script or debug switch that I could use which when run would (say) create a PATH log file along the lines of:
/etc/profile: /usr/bin
/etc/profile: /usr/contrib/bin
/home/
/opt/cgs/etc/profile: /opt/cgs/bin
I've now found where the part of the PATH variable that I'm interested in is set - /opt/cgs/etc/profile, so my immediate problem is over.
Thanks again,
Gary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 12:38 AM
01-25-2005 12:38 AM
Re: Where is PATH variable set?
I think the only way you could get this list of where individual parts of the PATH are set is by doing a echo of $PATH at the beginning and end of each files (/etc/profile.../.login etc.) and comparing the differences added in each file.
Sorry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 12:39 AM
01-25-2005 12:39 AM
Re: Where is PATH variable set?
I'm not a fan of long PATH variables at all. They can degrade startup performance but most important, they are a source of potential hacking. Every entry in /etc/PATH as well as any changes to $PATH should be verified that it is valid and necessary. I've attached a script that looks at /etc/PATH and then looks at the current value of $PATH. It will put out error messages for directory paths that do not exist, current working directory, or worse, are world-writable.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 12:53 AM
01-25-2005 12:53 AM
Re: Where is PATH variable set?
I must say, that's what I've done in the past - embed echo statements in .profile, etc. It is pretty cumbersome though.
Thanks for the script Bill, I'll have a look at that.
Cheers,
Gary