bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect bash?


From: mwoehlke
Subject: Re: How to detect bash?
Date: Tue, 10 Oct 2006 18:57:55 -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

Dave Rutherford wrote:
On 10/10/06, mwoehlke <mwoehlke@tibco.com> wrote:
Completely non-workable. That only works if the bash I want is in
/bin/bash

Well, no.  It works as long as the last thing in the path
is 'bash'.  It could be /usr/bin/bash, /home/bin/bash,
or yes, /bin/bash.  But why the heck don't you know,
if these systems are under your control?

I have root access, but they aren't "my" systems; rampantly changing them would Not Be Appreciated. And since when does '#! /bin/bash' mean "use whatever 'bash' you find in $PATH"? Silly me, I thought it meant "use '/bin/bash'".

I *probably* want '/home/install/gnu/<arch>/bin/bash' (note the *non-constant* in that path), but not on my desktop. Plus, part of the goal is for *other* people - who like me also may not have /home/install (and whose computers I don't have /any/ access to) - to be able to run the script.

The point is that about the only shebang you can rely on is /bin/sh, which rarely gets you what you actually *want*. There is almost always *some* shell at /bin/sh. It is often not the optimal one. Over here, we have *long* known that shebangs do not make for portable scripts. Instead I use the current shell, but come up with this little trick to make sure it's bash.

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.

--
Matthew
KDE: Desktop Excellence





reply via email to

[Prev in Thread] Current Thread [Next in Thread]