Hi Marco,

try:

echo $SHLVL

The value is incremented for each new sub shell - so it will be "1" for login 
shells (which you get with "su - ..."

Regards
Hubert


> -----Ursprüngliche Nachricht-----
> Von: "Marco Bosisio" <[email protected]>
> Gesendet: 03.03.09 11:12:04
> An: [email protected]
> Betreff: Which user env. variable tell me that it is in  "su - "   mode ?


> Hi,
>   do you know  wich user  environment variable I have to test  (executing
> a bash script)   to know  when  I am  in   "su -"   (switch user mode)   ?
> 
> 
> Reading variables provided  by  "env"  command   then testing   $TERM  I
> am able to  know  if  not  a Linux terminal :
> ..
> .......
> # We can only execute on a terminal SSH / Telnet ,   not  executed if
> secondary console Linux/zVM
> if [[ "$TERM" != "xterm" ]] ; then  exit
> fi
> ......
> 
> I would like to do the same  when the script  is executed  in a  user
> logged  in  "su -  "   mode...
> 
> Thanks in advance.
> 
> Cordiali saluti  / Best regards
> 
>  Marco Bosisio        IBM Italia S.p.A.
> 
> ----------------------------------------------------------------------
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO LINUX-390 or visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> 

-- 
Hubert Kleinmanns
Beratung / Schulung / Projektleitung

Chairman der WG "WebSphere MQ and Business Integration" in der GSE, deutsche Region.

Tel.: +49 (0) 60 78 / 7 12 21
Fax: +49 (0) 60 78 / 7 12 25
Mobil: +49 (0) 178 / 6 97 22 54
Web: www.kleinmanns.eu
GSE: www.gsenet.de

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to