dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* heredoc and subshell
@ 2016-02-23 22:07 Oleg Bulatov
  2016-02-23 22:49 ` Eric Blake
  2016-02-23 23:18 ` Jilles Tjoelker
  0 siblings, 2 replies; 9+ messages in thread
From: Oleg Bulatov @ 2016-02-23 22:07 UTC (permalink / raw)
  To: dash

Hello,

trying to minimize a shell code I found an unobvious moment with heredocs and subshells.

Is it specified by POSIX how next code should be parsed? dash output for this code differs from bash and zsh.

--- code
prefix() { sed -e "s/^/$1:/"; }
DASH_CODE() { :; }

prefix A <<XXX && echo "$(prefix B <<XXX
echo line 1
XXX
echo line 2)" && prefix DASH_CODE <<DASH_CODE
echo line 3
XXX
echo line 4)"
echo line 5
DASH_CODE

--- bash 4.3.42 output:
A:echo line 3
B:echo line 1
line 2
DASH_CODE:echo line 4)"
DASH_CODE:echo line 5

--- dash 0.5.8 output:
A:echo line 1
B:echo line 2)" && prefix DASH_CODE <<DASH_CODE
B:echo line 3
line 4
line 5

-- 
Oleg

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-24 20:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23 22:07 heredoc and subshell Oleg Bulatov
2016-02-23 22:49 ` Eric Blake
2016-02-23 23:16   ` Eric Blake
     [not found]   ` <56CCE1E3.1060805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-02-24 10:58     ` Joerg Schilling
     [not found]       ` <56cd8cd1.LdVYbpfe+0tQMm8I%Joerg.Schilling-8LS2qeF34IpklNlQbfROjRvVK+yQ3ZXh@public.gmane.org>
2016-02-24 12:27         ` Shware Systems
2016-02-24 12:32           ` Joerg Schilling
2016-02-24 20:27       ` Oleg Bulatov
2016-02-23 23:18 ` Jilles Tjoelker
2016-02-24  8:46   ` Thorsten Glaser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).