"\n" inside dq is _not_ interpreted by the shell (printf interprets it),
but I tend to agree that using sq is worry-free and better.
I suspect the very original was written (or copied from something that
wrote) like this:
re=$(echo -n "$1" | sed -e '...')
and mechanically replaced to
re=$(printf '%s' "$1" | sed -e '...')
because "echo" is not quite portable.
But the original misunderstands the command substitution. The trailing LF
is removed by it, so as long as "$1" is a single line, $re will get a line
without the trailing LF _anyway_.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author] Next message: [thread] [date] [author]
Messages in current thread:
Re: [PATCH] Improve sed portability, Junio C Hamano, (Thu Jun 12, 4:33 am)