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

Re: [Libguestfs] [PATCH nbdkit 08/10] freebsd: In scripts use 'env bash' instead of '/bin/bash'.

On 08/13/2018 04:23 PM, Richard W.M. Jones wrote:
On Mon, Aug 13, 2018 at 04:14:13PM -0500, Eric Blake wrote:
On 08/12/2018 03:51 AM, Richard W.M. Jones wrote:
The path to bash on FreeBSD is /usr/local/bin/bash.

+++ b/docs/make-links.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -
+#!/usr/bin/env bash

This loses the '-' argument that used to be passed by the kernel
(but you can't add it back to the #! linew without using BSD's or
GNU coreutils' recent addition of 'env -S').  Is it worth adding a
'set -' line later in the script to compensate, if you were
previously passing the '-' as a way to reset the shell from
inheriting environmental differences?

I actually had no idea what the '-' did until now :-)

Actually, I'm not sure if it does anything. 'set -u' isn't inherited across a #! setup, and I doubt anything else that 'set' controls would have an effect either (or people would have complained long before now on scripts that just do '#!/bin/bash' instead of '#!/bin/bash -').

I guess we need it.  I can add

   set -

to these scripts as required.

Only if it makes a difference that you can actually observe in testing - don't bother to do it otherwise.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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