[comp.unix.questions] execing a shell & .profile

drears@ARDEC.arpa (FSAC) (07/28/87)

   At our site we are running Ultrik 2.0 on a vax 8600.  We have
created several group accounts that people (if they are in the right
group) access through a setuid program that has the same name as the
group account.
   The program sets up a environment for them and then execs /bin/sh.
The person is then placed in that group account.  What I would like to
do is have the shell execute the .profile and possibly /etc/profile.
Is there any way I can tell /bin/sh to execute .profile or
/etc/profile?  I know I can have the user type . .profile but I do not
want this.

Dennis

P.S.   /bin/sh is actually an old version of the BRL shell.

jfh@killer.UUCP (The Beach Bum) (08/01/87)

In article <8528@brl-adm.ARPA>, drears@ARDEC.arpa (FSAC) writes:
>    The program sets up a environment for them and then execs /bin/sh.
> The person is then placed in that group account.  What I would like to
> do is have the shell execute the .profile and possibly /etc/profile.
> Is there any way I can tell /bin/sh to execute .profile or
> /etc/profile?  I know I can have the user type . .profile but I do not
> want this.

sure, the manual page for the shell, under the section marked `Invocation'
states, and i quote,

	"If the shell is invoked through exec(2) and the first character
	of argument zero is -, commands are initially read from /etc/profile
	and from $HOME/.profile, if such files exist."

		-- Plexus Sys5 Unix User's Reference Manual.

this has been a fairly constant feature of unix since the old days, except
that /etc/profile was added sometime around system 3 days.  you will need
to do something about the $HOME/.profile mess, such as set $HOME to the
correct directory for the group.

- john.
-- 
John F. Haugh II		HECI Exploration Co. Inc.
UUCP:	...!ihnp4!killer!jfh	11910 Greenville Ave, Suite 600
"Don't Have an Oil Well?"	Dallas, TX. 75243
" ... Then Buy One!"		(214) 231-0993