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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ksh: checking for users

Status
Not open for further replies.

ogniemi

Technical User
Nov 7, 2003
1,041
PL
I need to add an path to the PATH but only when logging user is root or user1. What is the shostest synhax of such test?

I added the following to my global profile, but how to extend this also for user1 not running again `whoami`?

[ `whoami` = root ] && export PATH=$PATH:/usr/sbin/cluster/utilities || return 0


r. m.
 
Hi,

You could add

export PATH=$PATH:/usr/sbin/cluster/utilities

to the local profiles of the users.

i.e. The file :-

~/.profile

(~ represents the users home dir)

Matt.
 
you right, but it is easier to operate/switch it on/off on global /etc/profile...

r, m.
 
Something like this ?
case `$logname` in
root|user1) export PATH=$PATH:/usr/sbin/cluster/utilities;;
esac

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top