Johannes Schindelin wrote:
On Sun, 18 Jan 2009, Jeff King wrote:
quoted
On Sun, Jan 18, 2009 at 10:41:13AM +0100, Stephan Beyer wrote:
quoted
Hmm, IIRC if $FIRSTLINE contains \n or something like that, it will
interpret this as newline in some shell/echo implementations.
So printf "...%s..." "$FOO" is always sane for user input.
But you are wrong. And Stephan is wrong, too.
The name "FIRSTLINE" suggests that it is indeed a first line, and
consequently cannot contain a newline.
I think the point was that $FIRSTLINE can contain a backslash sequence
such as (literally) \n or \r. Indeed 'man 1p echo' on my system says
_string_ A string to be written to standard output. If the first
operand is -n, or if any of the operands contain a
backslash ( '\' ) character, the results are
implementation- defined.
(Those POSIX manpages are really useful!)
--
Thomas Rast
trast@{inf,student}.ethz.ch