Re: POSIX woes in t7810.87: dash bash or bash dash?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 20, 2011 at 04:31:32PM -0700, Junio C Hamano wrote:

> >> +	cat >expected <<-EOF &&
> >> +	hello.c:	printf("Hello world.\n");
> >> +	EOF
> >
> > Do you need to quote EOF to suppress expansion in the here document?
> > Both bash and dash seem to pass unknown backslash-escapes like "\n"
> > through unharmed, but I don't know if that is portable (they do both
> > munge known escapes like "\\", of course).
> 
> I do not think that is strictly necessary, as we are not in the corner of
> non-portable echo behaviour anymore, but I guess it wouldn't hurt.

I think my brain is fried from using too many almost-shell-compatible
quoting languages. For example, unknown escape sequences in C get their
backslash removed and the sequence used literally (at least by gcc; I
couldn't find anything definite in C99 on this).

But actually, POSIX is quite clear that a backslash before anything
besides:

  $   `   "   \   <newline>

is just a backslash, and gets included literally.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]