Paul Eggert wrote:
> > I don't see that command substitution in general needs to output "text".
> 
> You're right there's nothing explicit about that. However, I doubt 
> whether $(X) will work portably if X outputs arbitrary binary data.

If that binary data contains bytes in the range 0x80..0xFF, it will
definitely not work portably: The result of such command substitution
will end up in a shell variable, and from there the script will most
likely want to pass it to a program, either as a command-line argument
or through an environment variable. On Windows, neither of the two
works, because it attempts to converts the byte sequence to a wchar_t
sequence. [1]

However, when the command's output is an arbitrary mix of bytes in
the range 0x01..0x7F, I would expect it to work portably.

Bruno

[1] https://sourceware.org/legacy-ml/cygwin/2009-08/msg00430.html




Reply via email to