[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
Wed Mar 1 20:53:05 EST 2017


> On Wed, Mar 01, 2017 at 04:09:11AM -0500, Bob Jonkman via talk wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi Scott: Why do this:
>>
>> #!/usr/bin/env bash
>>
>> and not the usual
>>
>> #! /bin/bash
>>
>> ???

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.  :-)

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


More information about the talk mailing list