execution environment (checking if in .profile)

XMRP50000[jcm]-a.v.reed avr at mtgzz.UUCP
Sat Feb 27 03:17:21 AEST 1988


In article <7162 at tut.cis.ohio-state.edu>, lvc at tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
> Is there a way for a program to tell if it was executed
> 1) via a users .profile or 2) by a user on their command line?
> Yes its a strange question, but can it be done?  Thanks,

It depends on the login shell. For example, ksh sets TMOUT
to the system-defined value (often 7200) when it leaves
.profile. Thus, if your user's login shell is ksh, put in
/etc/profile the lines
    TMOUT=0
    # or any value different from the system-defined value
    export TMOUT
    # so your program can examine it
    readonly TMOUT
    # so the user can't change it at the start of .profile
and then have the program check the value of TMOUT in env.
				Adam Reed (mtgzz!avr)



More information about the Comp.unix.questions mailing list