sbang: Fix perl binary detection

The perl binary can also be called `perlX.Y.Z` if using a development
build or simply using the versioned binary.

We were also dropping all sbang arguments, since `exec $interpreter_v`
was only using the first element of the `interpreter_v` array.
This commit is contained in:
Michael Kuhn 2020-01-16 10:34:02 +01:00 committed by Peter Scheibel
parent 33d35768e6
commit 95ddd3d6f2

View file

@ -103,10 +103,10 @@ interpreter_f="${interpreter_v[0]}"
# Invoke any interpreter found, or raise an error if none was found. # Invoke any interpreter found, or raise an error if none was found.
if [[ -n "$interpreter_f" ]]; then if [[ -n "$interpreter_f" ]]; then
if [[ "${interpreter_f##*/}" = "perl" ]]; then if [[ "${interpreter_f##*/}" = "perl"* ]]; then
exec $interpreter_v -x "$@" exec $interpreter -x "$@"
else else
exec $interpreter_v "$@" exec $interpreter "$@"
fi fi
else else
echo "error: sbang found no interpreter in $script" echo "error: sbang found no interpreter in $script"