delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/11/14/12:48:43

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=nLs0tFz0InHQNXta5h3L0ZgqSShPxg286I9p0YDkgX6
GTBXvCU85HaN1hJ283BHBBdfm97YCYqc/8iAjBXCfiVDCpOYnCjYJ9Kq3Q6K+sPk
wOIz9oMt9CrK5yJOuXwaFQt2SBvOrjvJBDSNkp8XAWryl2MQg910zwDq3MrSa8og
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=be53y1pCrSynlOygXr8qjnvQyfg=; b=MmGScFz3mryzREhak
SQ+kRaZYWSa40BynGcleYrVb/lvRNEA2uTXTIQzVLH1ncFeyG1uiAoTr2Iw3nrwZ
H46wjqnIRaIzKDAk+QRivaWxwvufoGLK07+3/K7/uMrCM6B8oY1fWUZX3GGUuT0b
ZJ45BVL1q2ls52T0+bs21U3ML8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=3.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_COUK,KAM_FROM_URIBL_PCCC,SPF_PASS autolearn=no version=3.3.2
X-HELO: out.ipsmtp3nec.opaltelecom.net
X-SMTPAUTH: drstacey AT tiscali DOT co DOT uk
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AlwCAC4/ZlRV0kmc/2dsb2JhbAANToNjWYMGyXeHUQMCAoE1AQEBAQGFAAEBBCMVQBELGAICBRYLAgIJAwIBAgE3AQ0TCAEBwx14ljQBAQEBBgEBAQEegS2PQjoWgmGBVAWQH4cDoiBtgksBAQE
X-IPAS-Result: AlwCAC4/ZlRV0kmc/2dsb2JhbAANToNjWYMGyXeHUQMCAoE1AQEBAQGFAAEBBCMVQBELGAICBRYLAgIJAwIBAgE3AQ0TCAEBwx14ljQBAQEBBgEBAQEegS2PQjoWgmGBVAWQH4cDoiBtgksBAQE
Message-ID: <54664064.9030102@tiscali.co.uk>
Date: Fri, 14 Nov 2014 17:48:20 +0000
From: David Stacey <drstacey AT tiscali DOT co DOT uk>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: sed anomaly in bash script
References: <CABa6CE=OFjPjomA9xQESG==MTjP9y=5UqeTgtg4fxnZjYqTEuw AT mail DOT gmail DOT com>
In-Reply-To: <CABa6CE=OFjPjomA9xQESG==MTjP9y=5UqeTgtg4fxnZjYqTEuw@mail.gmail.com>
X-IsSubscribed: yes

On 14/11/14 17:20, cyg Simple wrote:
> $ TEST=`echo 'c:\windows' | sed -e s.\\.\\\\.g`
> $ echo $TEST
> c:\\windows
>
> <file name=sed.sh>
> TEST=`echo 'c:\windows' | sed -e s.\\\.\\\\\.g'
> echo $TEST
> </file>
>
> $ bash -x sed.sh
> ++ echo 'c:\windows'
> ++ sed -e 's.\.\g'
> sed -e expression #1, char 7: unterminated 's' command
> + TEST=
> + echo
>
> CYGWIN_NT-6.1 HOSTNAME 1.7.32(0.274/5/3) 2014-08-13 23:06 x86_64 Cygwin
>
> Does anyone have a suggestion on turning c:\windows into c:\\windows?

I don't have a Windows PC to hand ATM, but the following works in Fedora 
bash:

#!/usr/bin/bash
TEST=$(echo "c:\windows" | sed -e "s;\\\\;\\\\\\\\;g")
echo ${TEST}


Dave.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019