Bug#3117: Tob needs whoami
>Good point. If I try to replace the
> if [ 'whoami' != root ] ; then
>by another test for not being root, what should I use? Will _everybody_
>have set $USER to their idendity when they either login as, or su to, root,
>under every possible shell?
>
>Does anybody have another idea or bash trick to this reliably without
>requiring /usr/bin/* or /usr/sbin/* stuff?
You could use `[ -w / ]' or `[ -O / ]' or some such, if you can assume
that / has sensible ownerships and permissions? Or (for example)
/bin/su has to be owned by root to work at all, so `[ -O /bin/su ]'
perhaps?
If you can assume bash, $UID will probably be better.
- Richard
--
http://www.elmail.co.uk/staff/richard/
GCS d- s+:- a-- C++ ULVS+++$ P+++ L++ E++ W(++,--) N(++,+) o? K w---
O? M- V? PS(+,+++) PE Y+ PGP+ t- 5++ X+@ R tv--- b++>++++ DI+ D+ G e++
h r% y++
Reply to: