Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-29-2012
Registered User
 
Join Date: Aug 2008
Posts: 12
Thanks: 3
Thanked 0 Times in 0 Posts
[Solved] Add directory to a global PATH

Guys,

I did a search on this but couldn't find any thing.

I need to add /home/scadm/scripts to the PATH. If I do the below it works for the session I'm in. If I close it and reopen it doesnt work.

Code:
PATH=$PATH\:/home/scadm/scripts ; export PATH

I also want this path added to all the users in the system.

thanks

Moderator's Comments:
Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 06-29-2012 at 10:15 AM..
Sponsored Links
    #2  
Old 06-29-2012
ctsgnb ctsgnb is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Location: France
Posts: 2,763
Thanks: 72
Thanked 587 Times in 561 Posts
you need to put this in the profile that is loaded when you log in.

(.profile .login .kshrc .bashrc , etc ...) just figure out in which profile it is suitable for your need to put it in.

For that, you can login and use the
Code:
ls -lduart .??*

and check which "dot file" has been accessed the latest.

By the way ... not sure that the backslash you use is necessary
Sponsored Links
    #3  
Old 06-29-2012
methyl methyl is offline Forum Staff  
Moderator
 
Join Date: Mar 2008
Posts: 6,388
Thanks: 286
Thanked 668 Times in 640 Posts
This would be safer syntax.

Code:
PATH="${PATH}:/home/scadm/scripts" ; export PATH

If you want to add the path to all users (presumably except system users) then the user's own profile file is the best place. I'd also add it to the skeleton profile file used by useradd ready for the next new user.

It may be tempting to modify /etc/profile but beware of modifying the PATH used by the root account or other system accounts because /home may not be mounted all the time.
    #4  
Old 06-29-2012
Registered User
 
Join Date: Aug 2008
Posts: 12
Thanks: 3
Thanked 0 Times in 0 Posts
Thanks it worked, I ended up updating .profile
Sponsored Links
Closed Thread

Tags
env, path

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[Solved] /var directory in HP-UX is showing 95%? yadvinder HP-UX 10 10-18-2011 01:49 AM
Retrieve directory path from full file path through sh royzlife Shell Programming and Scripting 7 09-21-2010 08:28 AM
How can we copy a directory from Global to Non-global zone? vijaysachin Solaris 8 11-18-2009 07:41 AM
sharing a directory between local and global zone binary0011 Solaris 1 08-29-2009 01:53 PM
Global PATH setting jxh UNIX for Dummies Questions & Answers 5 07-20-2001 05:23 PM



All times are GMT -4. The time now is 07:28 AM.