[Pkg-sysvinit-devel] Bug#826214: Bug #826214: Bug #826215: init-d-script and systemd: solution

Ian Jackson ijackson at chiark.greenend.org.uk
Tue Mar 7 12:49:48 UTC 2017


Michael Biebl writes ("Bug#826214: Bug #826214: Bug #826215: init-d-script and systemd: solution"):
> Which trick?

mariner:d> pwd
/u/iwj/junk/d
mariner:d> cat interp
#!/bin/bash
# interp: an "interpreter" written in bash
# you have to invoke it in #! with the env trick,
# ie #!/usr/bin/env /path/to/interp

set -e
echo "interp was invoked with \$0=$0 and \$*=$*"

script="$1"
shift

echo "interp has decided to run $1"

function_from_interp () {
    echo "interp's function_from_interp called: $*"
}

. "$script"
mariner:d> cat outer
#!/usr/bin/env /u/iwj/junk/d/interp

# this is a script using the "weird interpreter" interp
# which sets various shell functions and then sources us

function_from_interp hello "$*"
mariner:d> ./outer 
interp was invoked with $0=/u/iwj/junk/d/interp and $*=./outer
interp has decided to run 
interp's function_from_interp called: hello 
mariner:d> 



More information about the Pkg-sysvinit-devel mailing list