`declare -f` doesn't work properly with some function defs
Open
- Dominant language
- Shell
- Stars
- 19
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
`declare -f` does not produce a function that is syntactically correct if it has a particular usage of heredoc and `&&`.
Example:
```bash
a() {
echo hi &&
cat >/dev/null <<-EOF &&
texttexttext
EOF
echo bye
}
```
with `declare -f` the definition will become
```bash
a ()
{
echo hi && cat > /dev/null <<-EOF
texttexttext
EOF
&& echo bye
}
```
which will trigger a syntax error if parsed as shell script (notice the change of position of `&&`).
It seems that the first command and the third command are necessary for this behavior.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.