[GTALUG] Hashbang syntax in bash script [was: Watching a network folder: is there a smart way of doing this?\

Scott Elcomb psema4 at gmail.com
Thu Mar 2 19:50:58 EST 2017


On Thu, Mar 2, 2017 at 8:39 AM, Jamon Camisso via talk <talk at gtalug.org> wrote:
> On 01/03/17 20:53, Scott Elcomb via talk wrote:
>> On Wed, Mar 1, 2017 at 5:41 AM, William Park via talk <talk at gtalug.org> wrote:
>>> If you know /bin/bash is the right location, then use /bin/bash.  If
>>> not, let 'env' find it.
>>
>> Basically this; I've been bitten a couple times with a missing
>> /bin/bash (though never /bin/sh)
>>
>> Picked the trick up a few years ago (not sure where) and never looked back.  :-)
>
> Question: if /bin/bash doesn't exist, but it is defined via an env
> variable, what kind of system sets things up such that /bin/bash doesn't
> exist?
>
> I use /usr/bin/env for most things, but not for bash. Just
> curious/looking for a compelling reason to adopt it in future scripts.

It may have been a Cygwin instance, but tbh I just don't recall in
which environment I first encountered the issue.

In my day-to-day tasks, I spend lots of time in mixed environments,
managing systems with components that run across Linux, OSX and
Windows.  Additionally, there's a fair amount of time playing &
learning in other operating systems (BSD's, Plan 9, hobbyist OS's,
etc) as well.

-- 
  Scott Elcomb         @psema4
     http://www.pirateparty.ca/


More information about the talk mailing list