Marco Bosisio wrote:
Hi John,
the 'profile.local' launch 'script _xxx' and it checks "$TERM"
: only if set to ' XTERM' it continue.
(I prefer that "profile.local" remains simple and only contain
the call to 'script_xxx' with complex code)
Whatever TERM is set to, it's not a defined way of finding whether you
have a terminal at all.
Did you find this one?
08:21 [sum...@bobtail ~]$ echo $TERM
screen
08:21 [sum...@bobtail ~]$
It's used to discover what escape sequences to use to perform such
functions as position cursor, erase parts of the screen, set colours and
so on.
"dumb" is an arbitrary name used to describe an 80-column terminal with
not much functionality at all.
If you have a look at /etc/termcap you will see a lot of names, and if
you wished you could add some of your own.
In contrast, the tty command returns an actual device name when possible.
1) This is the secondary console where root is always active of a
Linux/zVM :
UID PID PPID C STIME TTY TIME CMD
root 1342 1 1342 1342 0 Jan28 ttyS0 00:00:00 /bin/sh
--login
And 'dumb' is the content of "$TERM" of SuSE SLES8 - SLES9 -
SLES10, REDHAT AS 4 :
echo $TERM
dumb
lx1iard0:/ #
In this case the 'script_xxx' cannot be executed.
2) When an user is logged via SSH/Putty 'xterm' is the content of
"$TERM" :
lx1iard0:~ # echo $TERM
xterm
In this case the 'profile.local' launch the 'script_xxx' and it can
continue.
3) When I use ' su - ' I would like that the 'profile.local'
launch 'script_xxx' but it ( 'script_xxx') has to check something
(???) and I can chose if terminate or take another way.
Ciaoo....
Cordiali saluti / Best regards
Marco Bosisio IBM Italia S.p.A
John Summerfield <[email protected]>
Sent by: Linux on 390 Port <[email protected]>
03/03/2009 13.09
Please respond to
Linux on 390 Port <[email protected]>
To
[email protected]
cc
Subject
Re: Which user env. variable tell me that it is in "su - " mode ?
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
IBM Italia S.p.A.
Sede Legale: Circonvallazione Idroscalo - 20090 Segrate (MI)
Cap. Soc. euro 400.001.359
C. F. e Reg. Imprese MI 01442240030 - Partita IVA 10914660153
Societ� soggetta all?attivit� di direzione e coordinamento di
International Business Machines Corporation
(Salvo che sia diversamente indicato sopra / Unless stated otherwise
above)
----------------------------------------------------------------------
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
--
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