help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set -m && bash -c "/bin/foo" works but bash -m -c "/bin/foo" doesn't


From: Alex fxmbsw7 Ratchev
Subject: Re: set -m && bash -c "/bin/foo" works but bash -m -c "/bin/foo" doesn't
Date: Mon, 10 Oct 2022 08:35:24 +0200

setsid <opts> cmd

On Sun, Oct 9, 2022, 22:13 Britton Kerin <britton.kerin@gmail.com> wrote:

> 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
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]