bug-bash
[Top][All Lists]
Advanced

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

Parse error of function definition with here doc in command substitution


From: D630
Subject: Parse error of function definition with here doc in command substitution
Date: Sun, 16 Oct 2022 16:45:06 +0000

Hi,

In version `5.2.0(1)-rc2 (x86_64-pc-linux-gnu)` from Debian, this code


```
_=$(
        f1() {
                c <<-!
                !
        }
        f2() {
                :
        }
)
```

results in

```
bash: command substitution: line 15: syntax error near unexpected token `('
bash: command substitution: line 15: `}function f2 () '
```

This one looks good at first:

```
_=$(
        f2() {
                :
        }
        f1() {
                c <<-!
                !
        }
)
```

But this not:

```
_=$(
        f2() {
                :
        }
        f1() {
                c <<-!
                !
        }
        f1
)
```

This works:

```
_=$(
        f2() {
                :
        }
        f1() {
                c
        } <<-!
        !
        f1
)
```




reply via email to

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