Re: dash bug: double-quoted "\" breaks glob protection for next char

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

 



On Mon, Apr 02, 2018 at 08:57:35PM +0200, Denys Vlasenko wrote:
>
> I see this:
> 
> $ x='\t'; echo "[$x]"
> [    ]
> 
> I'm pretty sure this isn't okay...

Why not? dash has always behaved like this and this is explicitly
required by POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

	OPERANDS
	The following operands shall be supported:

	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.

	[XSI] [Option Start]
	On XSI-conformant systems, if the first operand is -n, it shall
	be treated as a string, not an option. The following character
	sequences shall be recognized on XSI-conformant systems within
	any of the arguments:

	\a
	Write an <alert>.
	\b
	Write a <backspace>.
	\c
	Suppress the <newline> that otherwise follows the final argument
	in the output. All characters following the '\c' in the arguments
	shall be ignored.
	\f
	Write a <form-feed>.
	\n
	Write a <newline>.
	\r
	Write a <carriage-return>.
	\t
	Write a <tab>.
	\v
	Write a <vertical-tab>.
	\\
	Write a <backslash> character.
	\0num
	Write an 8-bit value that is the zero, one, two, or three-digit
	octal number num.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux