docker-proxy icon indicating copy to clipboard operation
docker-proxy copied to clipboard

Trap not work on debian 8

Open rlanore opened this issue 10 years ago • 4 comments

trap not execute on debian with /bin/sh link to /bin/dash

workarround create link /bin/sh to /bin/bash

rlanore avatar Oct 22 '15 13:10 rlanore

Or use #!/bin/bash instead of #!/bin/sh

muelli avatar Nov 01 '15 13:11 muelli

iirc, I used /bin/sh to deal with systems that didn't have bash installed, although I can't remember off the top of my head which systems those were. Happy to switch it to /bin/bash and see how people go - if there are complaints, there'll have to be a new solution.

silarsis avatar Nov 02 '15 04:11 silarsis

fair enough. The alternative is to avoid bashisms (e.g. http://mywiki.wooledge.org/Bashism ) for portable shell scripts.

muelli avatar Nov 02 '15 09:11 muelli

Nice page, thanks. The problem with this one in particular is that the trap is used to ensure that the routing rules are removed on exit, regardless of success or failure. I could, perhaps, move to two scripts and exit codes, but that would take a bit more re-jigging. I don't see a trap alternative on that page.

silarsis avatar Nov 02 '15 11:11 silarsis