Lars Schneider [off-list ref] writes:
BTW: I am using this little snippet to apply patches from the mailing:
PATCH=$(curl -L --silent https://public-inbox.org/git/xmqqr2tpcn6g.fsf@gitster.mtv.corp.google.com/raw);
((printf '%s' "$PATCH" | git am -3) || (git am --abort; printf '%s' "$PATCH" | git apply)) &&
echo && echo "Patch successfully applied"
Does this look sensible to you?
Sensible? I have no answer. I wouldn't trust printf well enough to
stuff large value in a shell variable and feeding it myself in the
first place, but I would not be surprised if you did
VAR=$(command) && printf '%s' "$VAR" >output
and ended up with a file with an incomplete line at the end.