The double-fork fed into the shell at the end of the pipeline causes the process to be orphaned and thus adopted by init.
Upsides: - Removes unnecessary shell processes, especially for long-running processes that may be started with dmenu_run - Makes pstree(1) output look nicer ;) Downsides(?): - dmenu_run script is less simple :( - if the user is using a non-Bourne shell (without '(..) &' as syntax), the script breaks because we are piping Bourne shell syntax into ${SHELL:-"/bin/sh"} -- the whole reason we use $SHELL is so users can type shell commands into dmenu_run; this would still be possible, but now we only support users using a Bourne-compatible shell ! I don't know if this is really worth it at all, but I saw the /bin/sh in my pstree output and wanted to see if I could tweak this to get rid of it :p if there is a method to do this which is portable across shells it may be worth it to do that. --- dmenu_run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmenu_run b/dmenu_run index 834ede5..b7b3aca 100755 --- a/dmenu_run +++ b/dmenu_run @@ -1,2 +1,2 @@ #!/bin/sh -dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & +echo '( ' $(dmenu_path | dmenu "$@") ') &' | ${SHELL:-"/bin/sh"} -- 2.50.0