Marco Bosisio wrote:
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 :

That probably isn't as useful as you think, TERM can have almost any value.
See man(1) tty


for what I think you want.

Also, to test whether you're root, man(1) id.
To test whether you can write a particular file,
test --help
eg
test -w /bin/bash

It's preferable to test for the relevant capability, you may have some
security software (eg selinux) that prevents even root from doing some
things.




--

Cheers
John

-- spambait
[email protected]  [email protected]
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

----------------------------------------------------------------------
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