bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sed? escaping back slash


From: Hans-Bernhard Broeker
Subject: Re: sed? escaping back slash
Date: 8 Mar 2001 14:10:10 GMT

Craig Allsop <address@hidden> wrote:
> echo test | sed "s/test/\\/"

> Under 4dos shell in Win98, Cygwin GNU version v1.18 gives: \
> Under 4dos shell in Win98, Cygwin GNU version v3.02 gives: char 9:
> Unterminated 's' command

[Didn't you ask the same thing a few weeks ago, already???]

The problem you see may not actually be in 'sed', but rather in your
shell.  In particular, the command line quoting behaviour of your
shell may cause all kinds of strange artifacts. In case of doubt, you
should do this kind of check with a sed script stored in a file, not
with one given on the command line.

For reference: in BASH 1.14 on a Linux box, e.g., I get this:

acp3bf:~$ sed --version
GNU sed version 2.05
acp3bf:~$ echo test | sed "s/test/\\/"
sed: Unterminated `s' command
acp3bf:~$ echo test | sed 's/test/\\/'
\

But in TCSH, with the same 'sed':

acp3bf-broeker ~> echo test | sed "s/test/\\/"
\
acp3bf-broeker ~> echo test | sed 's/test/\\/'
\

I.e. the choice of shell has a non-negligible effect on the outcome of
the test, at least on Unix.



-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]