[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ‘command … &’ creates subshell
From: |
Greg Wooledge |
Subject: |
Re: ‘command … &’ creates subshell |
Date: |
Wed, 1 Jul 2020 13:57:17 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Jul 02, 2020 at 12:46:33AM +0700, Robert Elz wrote:
> POSIX says:
>
> If command is specified, exec shall not return to the shell;
>
> but in bash...
>
> bash
> jinx$ echo $$
> 23361
> jinx$ exec :
> bash: exec: :: not found
> jinx$ echo $$
> 23361
You're in an interactive shell. Bash chose this behavior to make your
life better.
unicorn:~$ cat foo
#!/bin/bash
exec :
echo "I am still here"
unicorn:~$ ./foo
./foo: line 2: exec: :: not found
unicorn:~$