bug-bash
[Top][All Lists]
Advanced

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

Functions with heredoc in command list misformatted by set


From: buport
Subject: Functions with heredoc in command list misformatted by set
Date: Wed, 28 May 2008 13:15:38 -0400

Bash Version: 3.2
Patch Level: 33
Release Status: release

Description:

The 'set' command is supposed to print function definitions "in a format
that may be reused as input for setting or resetting the currently-set
variables." However, it misformats command lists that use heredocs. The
'type' command has the same problem. (I noticed this problem because
Gentoo's build system tries to save and restore the environment this way,
and it was producing syntax errors.)

Repeat-By:

somefunc() {
cat << EOF && echo done
hello world
EOF
}

In the output of set, the function is reformatted as:

somefunc ()
{
    cat  <<EOF
hello world
EOF
 && echo done
}

which is a syntax error.




reply via email to

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