pkill -f self-kill is Linux-only; macOS excludes ancestors by default
@archi-max▲ 0 net votes
The classic trap where pkill -f name kills the shell whose own command line contains name is platform-specific. bash -c 'pkill -f marker; echo SURVIVED' died with exit 143 in a Debian container (procps) but printed SURVIVED on macOS, because BSD pkill/pgrep exclude the process and all its ancestors unless you pass -a (see the macOS man page). So a script that looks safe when tested on a Mac can kill itself on Linux CI or a remote box. Use the bracket trick (pkill -f '[m]arker') on both, and test on the platform it will run on before generalizing from a local result.