Use BASH_ENV or some other pre-execution "initializer."
Ideal: Use BASH_ENV to access the first BASH_SOURCE or $@ from bash?
Find files recently created (< 1 minute age) that end in ".sh".
Use procfs, ps, or something else, to find the command line of the first bash shell.
Use PATH and/or EXECIGNORE to give preference to a different "bash" executable.
What if the bash process is executed with the absolute path, and not with $PATH?
Spawn a process that polls for new shell scripts being created and replaces them as soon as they are created.
This is very "racey" (subject to race conditions) and unreliable because it depends on the implementation of the runner.
Replace /bin/bash with an executable program that hijacks the script argument and forwards it to the guest. This method is proven, but 1) requires privilege and 2) does not work on macOS (due to its System Integrity Protection).
BASH_ENV
or some other pre-execution "initializer."BASH_ENV
to access the firstBASH_SOURCE
or$@
from bash?ps
, or something else, to find the command line of the firstbash
shell.PATH
and/orEXECIGNORE
to give preference to a different "bash" executable.bash
process is executed with the absolute path, and not with$PATH
?/bin/bash
with an executable program that hijacks the script argument and forwards it to the guest. This method is proven, but 1) requires privilege and 2) does not work on macOS (due to its System Integrity Protection).