* Re: Dash quoting bug?
[not found] <474EBF87.3040103@sunshineco.com>
@ 2007-11-30 0:23 ` Herbert Xu
2007-11-30 14:33 ` Eric Sunshine
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2007-11-30 0:23 UTC (permalink / raw)
To: Eric Sunshine; +Cc: Andres Freund, dash
On Thu, Nov 29, 2007 at 08:32:55AM -0500, Eric Sunshine wrote:
>
> According to the dash manual, within single quotes, all characters are
> treated as literals (except single quote), which appears to agree with
> POSIX, so the above behavior seems incorrect.
We need a patch for the dash manual :)
Unfortunately according to POSIX we must interpret these escape sequences:
12680 NAME
12681 echo - write arguments to standard output
12682 SYNOPSIS
12683 echo [string ...]
12684 DESCRIPTION
12685 The echo utility writes its arguments to standard output, followed by a <newline>. If there are
12686 no arguments, only the <newline> is written.
12687 OPTIONS
12688 The echo utility shall not recognize the "- -" argument in the manner specified by Guideline 10
12689 of the Base Definitions volume of IEEE Std 1003.1-200x, Section 12.2, Utility Syntax Guidelines;
12690 "- -" shall be recognized as a string operand.
12691 Implementations shall not support any options.
12692 OPERANDS
12693 The following operands shall be supported:
12694 string A string to be written to standard output. If any operand is -n, it shall be treated as
12695 a string, not an option. The following character sequences shall be recognized
12696 within any of the arguments:
12697 \a Write an <alert>.
12698 \b Write a <backspace>.
12699 \c Suppress the <newline> that otherwise follows the final argument in the
12700 output. All characters following the '\c' in the arguments shall be
12701 ignored.
12702 \f Write a <form-feed>.
12703 \n Write a <newline>.
12704 \r Write a <carriage-return>.
12705 \t Write a <tab>.
12706 \v Write a <vertical-tab>.
12707 \\ Write a backslash character.
12708 \0num Write an 8-bit value that is the zero, one, two, or three-digit octal number
12709 num.
I suggest that you switch over printf for portability. That is, replace
all occurances of
echo "string"
with
printf "%s\n" "string
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Dash quoting bug?
2007-11-30 0:23 ` Dash quoting bug? Herbert Xu
@ 2007-11-30 14:33 ` Eric Sunshine
0 siblings, 0 replies; 2+ messages in thread
From: Eric Sunshine @ 2007-11-30 14:33 UTC (permalink / raw)
To: dash
Herbert Xu wrote:
> On Thu, Nov 29, 2007 at 08:32:55AM -0500, Eric Sunshine wrote:
>> According to the dash manual, within single quotes, all characters are
>> treated as literals (except single quote), which appears to agree with
>> POSIX, so the above behavior seems incorrect.
> We need a patch for the dash manual :)
> Unfortunately according to POSIX we must interpret these escape sequences:
> 12682 SYNOPSIS
> 12683 echo [string ...]
> 12695 The following character sequences shall be recognized
> 12696 within any of the arguments:
> 12703 \n Write a <newline>.
Thank you for the response and for pointing out this documentation.
> I suggest that you switch over printf for portability. That is,
> replace all occurances of
> echo "string"
> with
> printf "%s\n" "string
Unfortunately, in this case, a portability requirement to older
platforms lacking 'printf' negates the viability of such a solution. As
it turns out, however, I was able to resolve the issue by eliminating
the need to emit backslashes, thus altogether side-stepping the problem.
-- ES
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-30 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <474EBF87.3040103@sunshineco.com>
2007-11-30 0:23 ` Dash quoting bug? Herbert Xu
2007-11-30 14:33 ` Eric Sunshine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox