KSHPR: prompt generator for .kshrc

Bill Carpenter wjc at ho5cad.ATT.COM
Sat Jun 24 16:53:46 AEST 1989


In article <19817 at cup.portal.com> thad at cup.portal.com (Thad P Floryan) writes:

> The following is a l'il qwik'n'dirty you may find useful.  If you know of some
> other method to determine whether one is running su'd or not, please share it.
> This posting is to unix-pc.sources and comp.sys.att since it's of potential use
> to any UNIX user of ksh.

While not su-ed (like in .profile), create a file, e.g., /tmp/try.
chmod 044 /tmp/try.  (Obviously, you need a more unique filename.)

Here's the test you asked for:

           if [ -r /tmp/try ]
           then
             echo I am su-ed
           else
             echo I am not su-ed
           fi
--
   Bill Carpenter         att!ho5cad!wjc  or  attmail!bill



More information about the Unix-pc.sources mailing list