[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: |
Tue, 11 Oct 2022 09:48:13 +0200 |
On Mon, Oct 10, 2022, 22:13 Chet Ramey <chet.ramey@case.edu> wrote:
> On 10/9/22 3:50 PM, Britton Kerin 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"')
>
> It works for me from a terminal:
he maybe has some raw er case , like when init=/bin/bash such errs appeared
for me from long ago
$ ../bash-5.2-patched/bash -m -c '/bin/echo foo'
> foo
>
> and in a pipeline:
>
> $ echo abcde | ../bash-5.2-patched/bash -m -c '/bin/cat' | /bin/cat
> abcde
>
> >
> > 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.
>
> You get that message when bash doesn't have a controlling terminal or isn't
> in the terminal's foreground process group, when job control isn't
> possible.
>
> You might try
>
> bash -c 'set -m ; rest of command string'
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
>
>
>