Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternate $HOME when using su -

Status
Not open for further replies.

aixTim

MIS
Jun 19, 2002
32
NL
(aix 5.1 ml3)

I have a user fred with home directory /home/fred1
I have an alternate environment for fred at /home/fred2
I want to be able to

su - fred -c "do something here with $HOME = /home/fred2"

(fred's .profile is different in fred1 & fred2)

I could chuser fred before and afterthe su to set and reset the home directory - but ther must be a better way?
 
just run the other .profile before you run the command you are su'ing to do.

su - fred -c ". /home/fred2/.profile;command"

Note the space between the . and the /home/fred2/.profile.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top