execution environment (checking if in .profile)
XMRP50000[jcm]-a.v.reed
avr at mtgzz.UUCP
Tue Mar 1 06:15:20 AEST 1988
In article <7349 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?
> >Thus, if your user's login shell is ksh, put in /etc/profile
> > TMOUT=0 ; export TMOUT ; readonly TMOUT
> >and then have the program check the value of TMOUT in env.
> While writing this I thought of a way to defeat this (albeit obscurely).
> This might work in the .profile
> /bin/ksh<<-EOF
> TMOUT=2313 ;program
> EOF
> Since the readonly attribute is not propogated to children, TMOUT gets set
> and the program will run.
However, it is easy to check whether the ppid is that of the head
process (normally = the login shell) on the user's tty, and assume
the worse if it isn't.
Adam Reed (mtgzz!avr)
More information about the Comp.unix.wizards
mailing list