== A _bash_ irritation: the incompatible _exec_ There are a reasonable number of good things about _bash_ (and the general GNU program attitude of which it is a standards-bearer). But [[every so often MutableBashHistory]] it does something that causes me to grind my teeth. This time around the irritation is what _bash_ has done to the innocent _exec_ command. What they've done is simple: they've made _exec_ take options. The easiest way to explain the problem with this is in illustrated form. So: > _sh$ exec -rc_ \\ > <... program runs ...> > > _bash$ exec -rc_ \\ > _bash: exec: -r: invalid option_ \\ > _exec: usage: exec [-cl] [-a name] file [redirection ...]_ \\ > _bash$ exec -- -rc_\\ > <... program runs ...> > > sh$ exec -- -rc > exec: --: not found Oops. Since bash's _exec_ takes options, it must complain about invalid options. This makes it reject valid programs that happen to start with a dash, so it needs a way around that, but the way is not compatible with other Bourne shells because, of course, _exec_ does not take options so there is no need to support an option to ignore things that look like options. (As a bonus irritation bash does this *all the time*, not just when invoked as _bash_. So much for compatibility.) If you are in this situation, it may be helpful to know that one way of checking to see if you are in _bash_ is to look for the presence of a (($BASH_VERSINFO)) environment variable. There are probably better ways, but this one works well enough for me and I could spot it in the _bash_ manpage. (I stubbed my toe on this today because Ubuntu 8.04 changed _/bin/sh_ from _bash_ to another, more strictly Bourne compatible shell, which made my previous slapdash workaround stop working so I had to actually pay attention to this issue.)