set -m && bash -c "/bin/foo" works but bash -m -c "/bin/foo" doesn't
From:
Britton Kerin
Subject:
set -m && bash -c "/bin/foo" works but bash -m -c "/bin/foo" doesn't
Date:
Sun, 9 Oct 2022 11:50:36 -0800
The man page says the options available to set are also usable from
the command line.
I wanted to run a backgroup script in a new process group from vim and
print the PGID.
I ended up with the following:
:echo system('set -m && bash -c '."'".'((/bin/foo &) && eval
"echo -n \$\$")'."'")
I thought it would be nicer to use bash -m but it doesn't work (simple example):
:echo system('bash -m -c "echo foo"')
says:
bash: cannot set terminal process group (31921): Inappropriate
ioctl for device
bash: no job control in this shell
So it seems bash -m and set -m are not equivalent in this context at least.
Is it safe to assume set -m use this way will continue to work?
Is there a less torturous way to create new process groups and get PGID?
Thanks,
Britton