mwoehlke wrote:
> Anyone have any clever, VERY reliable tricks for detecting if the
> current shell is bash? The obvious way is '[ -n "$BASH" ]', but in the

I would probably avoid the clever and go with the simple to understand
and unlikely to be accidentally invoked method.

  test ${BASH_VERSION+set} = set && echo yes || echo no

Sure someone could work around it but they are unlikely to do so.  And
if they want to work around it as has been noted then they could
always edit the script.

And I agree with you that pattern matching against $SHELL does not
work.  It is often not the shell that is currently running.

  SHELL=/bin/csh bash -c 'printenv SHELL'
  /bin/csh

> >And why the heck do you think this is is *bug* in *bash*?
> 
> Um, did I say I did? I didn't see a not-bugs list, and I'm not the first 
> one to ask a 'How do I...' question here.

Your question was specific to bash and so I think it is perfectly good
and on topic here.  I specifically mention because I called another
poster about that just recently.

Bob


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to