posixWriteCommand function
The POSIX command that writes its stdin to file path: into a temporary
file first, and onto path only once all of it has arrived — copied into
the existing file (not moved over it), so its mode and owner stay.
Implementation
String posixWriteCommand(String path) =>
't=\$(mktemp) || exit 1; cat > "\$t" && cat < "\$t" > ${posixQuote(path)}; '
's=\$?; rm -f "\$t"; exit \$s';