From ripley at stats.ox.ac.uk  Thu Sep 28 17:28:14 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 28 Sep 2006 16:28:14 +0100 (BST)
Subject: [Rd] Warning on backslash sequences (was sprintf behavior)
In-Reply-To: <x2fyecja40.fsf@viggo.kubism.ku.dk>
References: <20060925094613.B5FB64C91E@slim.kubism.ku.dk>
	<Pine.GSO.4.56.0609260959290.2640@durian.statsci.com>
	<Pine.LNX.4.64.0609270922370.19951@gannet.stats.ox.ac.uk>
	<Pine.GSO.4.56.0609270750050.3216@durian.statsci.com>
	<Pine.LNX.4.64.0609271718410.18168@gannet.stats.ox.ac.uk>
	<971536df0609280655t63ce8be2ie159aba2e6539bc4@mail.gmail.com>
	<x2odt0jc2a.fsf@viggo.kubism.ku.dk>
	<971536df0609280803p7e3f35e6jfd6daecfe31496ea@mail.gmail.com>
	<x2fyecja40.fsf@viggo.kubism.ku.dk>
Message-ID: <Pine.LNX.4.64.0609281624550.14156@gannet.stats.ox.ac.uk>

On Thu, 28 Sep 2006, Peter Dalgaard wrote:

> "Gabor Grothendieck" <ggrothendieck at gmail.com> writes:
>
>> That's a good idea for the case I mentioned although there is still
>> the case where one requires a single quoted string (maybe for
>> generating code for some other language) and that is
>> not handled by deparse.
>
> Yes, but there be devils lurking in there. I think you do in general
> need to know what the other language is. Take a look at shQuote(), for
> instance. (Why, BTW, does that not simply "escape" single quotes using
> '"'"' instead of switching to double-quotes and escaping everything in
> sight?)

I suspect because the references consulted suggested that was not 
portable.  Since 'sh' covers many variants (at least Bourne sh, ash, bash, 
ksh, zsh) it is hard to get definitive answers.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




[Rd] Warning on backslash sequences (was sprintf behavior)
Prof Brian Ripley