jpetazzo / pipework

Software-Defined Networking tools for LXC (LinuX Containers)
Apache License 2.0
4.21k stars 727 forks source link

Change shebang to /bin/bash #252

Closed alexamirante closed 9 months ago

alexamirante commented 9 months ago

In Ubuntu the default shell points to dash rather than bash. As such, this substitution (line 375):

    GUEST_IFNAME=${GUEST_IFNAME:0:15}

returns an error as that syntax is not supported by dash. Setting the shebang do /bin/bash fixes this.

jpetazzo commented 9 months ago

Good point, thanks for catching this!

yoursunny commented 5 months ago

I have been using this script (specifically pipework --wait subcommand) in Alpine-based containers, where the default shell is ash and there's no bash command. I'd suggest reverting this change and rewriting the ${GUEST_IFNAME:0:15} with awk or similar utility.

ClausKlein commented 5 months ago

I use a busybox container without bash too

jpetazzo commented 5 months ago

For now, my recommendation would be to add bash to your container; but if someone wants to replace the ${GUEST_IFNAME:0:15} with a call to cut, I'll be happy to receive a PR! 👍