Re: Command substitution in here-documents

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

 



Simon Ser wrote:
>I'm trying to use command substitution in here-documents. Here's my script:
>
>  cat <<EOF
>  `echo hi`
>  EOF
>
>This seems not to work in dash 0.5.9.1. It fails with this error:
>
>  dash: 1: > : not found

'git bisect' points to commit 7c245aa8ed33ba5db30eef9369d67036a05b0371
([PARSER] Simplify EOF/newline handling in list parser) as being at
fault.  This dates from October 2014 so the last good tagged release
is 0.5.8.  Reverting the commit makes the problem go away.

Some observations:

- The error only occurs when the commands are run from the command line;
  if run from within a script it works.  This is probably because...

- It appears that the prompt is being injected into the text of the
  command substitution.  If PS2 is an empty string the command works.

- Fixing this (other than using the blunt instrument of reverting the
  faulty commit) is beyond my pay grade.  Someone with a better
  understanding of the code will need to take a look.

Ron



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux