Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sourceware.cygnus.com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin@sourceware.cygnus.com>
List-Help: <mailto:cygwin-help@sourceware.cygnus.com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner@sourceware.cygnus.com
Delivered-To: mailing list cygwin@sourceware.cygnus.com
Message-ID: <394FA231.19A148C0@veritas.com>
Date: Tue, 20 Jun 2000 09:56:17 -0700
From: Bob McGowan <rmcgowan@veritas.com>
Organization: VERITAS Software
X-Mailer: Mozilla 4.73 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin@sourceware.cygnus.com
Subject: Re: Bug of bash with sed operation ???
References: <394F8117.EF7EEB1C@cisco.com> <20000620104703.A8791@cygnus.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit

Chris Faylor wrote:
> 
> On Tue, Jun 20, 2000 at 10:35:03AM -0400, Zhiguang Qian wrote:
> >Hi,
> >
> >Here is the sample.
> >
> >>>export MY=\aaa\bbb.c
> >>>echo $MY | sed -e 's#\\#\/#g'
> >>> /aaa/bbb.c
> >>>out=`echo $MY | sed -e 's#\\#\/#g'`
> >>> sed: -e expression #1, char 8: Unterminated `s' command
> >
> >Try it.
> 
> I did.  Have you tried it on UNIX?  Same effect.  It's not a bug.
> 
> Your \\ is being eaten inside the ` ...  ` command.  You probably need
> to double up on these when you are using them inside of backquotes (or
> " style quotes for that matter).
> 

I tried it too, but things didn't work as described above, from line
one.  After assigning to MY and doing a simple echo, bash printed:

   aaabbb.c

The initial single backslashes are stripped to begin with (normal escape
processing).  So I could not get any output looking like "/aaa/bbb.c". 
Perhaps I missed something in an earlier post?

I got the last part, unterminated `s' command, in both bash
2.03.0(2)-release (CD 1.0) and 2.04.0(1)-release (from the net).  As
Chris notes this is normal behavior due to two passes through the
interpreter for command substitution rather than one as in the first sed
case.

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan@veritas.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

