[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to detect bash?
From: |
mwoehlke |
Subject: |
How to detect bash? |
Date: |
Tue, 10 Oct 2006 16:08:05 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.0 |
Anyone have any clever, VERY reliable tricks for detecting if the
current shell is bash? The obvious way is '[ -n "$BASH" ]', but in the
interest of catching idiots that set BASH to get around such a check, I
came up with:
[ "`BASH_SUBSHELL=975 ; ( echo $BASH_SUBSHELL )`" -eq 976 ]
(975 is of course an arbitrary number.)
Anyone think they know a better way (or a reason the above might not
work)? I'm guessing it can still be circumvented*, but one would have to
be specifically making an effort to do so.
(* Actually, I'm not 100% certain it can; you have to be able to run a
script upon sub-shell startup. I'm assuming that can be done, but maybe
I'm wrong...)
--
Matthew
KDE: Desktop Excellence
- How to detect bash?,
mwoehlke <=
- Re: How to detect bash?, Dave Rutherford, 2006/10/10
- Re: How to detect bash?, mwoehlke, 2006/10/10
- Re: How to detect bash?, Dave Rutherford, 2006/10/10
- Re: How to detect bash?, mwoehlke, 2006/10/10
- Re: How to detect bash?, Bob Proulx, 2006/10/11
- Re: How to detect bash?, Paul Jarc, 2006/10/11
- Re: How to detect bash?, mwoehlke, 2006/10/11
Message not available