On 03/23/2017 04:49 AM, Jean Delvare wrote:
> Apparently it requires a more recent version of mksh than we are
> shipping:

Herestrings are old. Should work in just about any ksh.

> $ echo $KSH_VERSION
> @(#)MIRBSD KSH R50 2014/06/29 openSUSE
> $ ./test_return.sh
> ./test_return.sh[10]: syntax error: '(' unexpected
> 
> But indeed works find with the latest upstream version, thanks for the
> pointer.

It's also not at all equivalent to a pipe. The shell reads the command
output from a pipe, stripping trailing newlines, and dumps the result
into a temporary file, which then adds a trailing newline, then reads
the file back into whatever runs in the loop. It will also fail if it
expands to more than one word due to lack of quotes. (That likely
caused your error)

There are a few legitimate uses for <<<"$(cmd)", which mostly have to
do with wanting that temp file for some reason, but typically don't use
it without good reason.


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to