| delorie.com/archives/browse.cgi | search |
| 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:to:from:subject:date:message-id:references | |
| :mime-version:content-type:content-transfer-encoding; q=dns; s= | |
| default; b=uTrNZuUilP6yaM2jpco6I0/TOEzYaTMqxAEKrwf6psLD33Gd0gD0s | |
| A4ccaEW5IQ7mBtrJhcoFZ5eVhmSjRxJdqbULbBkPDLFWsSMPa9UxrtgfDlTMZpoJ | |
| AsctDNQzQT70Ju4Zfjv3Bv3pFtvti7Pfl+3Bn4Bzng8mwoVTcVp5Rk= | |
| 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:to:from:subject:date:message-id:references | |
| :mime-version:content-type:content-transfer-encoding; s=default; | |
| bh=Qc+WSuZGuBSfVBvmKKMqMnWmEVg=; b=hdxhaiSAYLxtnBnANzdp/f4MVFq/ | |
| M8en/U877PjAlzFoDYwO8lOeJiBNbEc1JkbUPzx++BOI0mt5/Jo7w7LlVPW4vURo | |
| K6uOY2c6tMFgmvVkGn9/ApPgciq0xaPvGD8Yh68ZF9SER4fkR/725CdvnxD5nXU4 | |
| X5R9+/pjxWmtum0= | |
| 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=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 |
| X-HELO: | plane.gmane.org |
| To: | cygwin AT cygwin DOT com |
| From: | Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca> |
| Subject: | Re: sed anomaly in bash script |
| Date: | Sat, 15 Nov 2014 04:40:59 +0000 (UTC) |
| Lines: | 23 |
| Message-ID: | <loom.20141115T053607-916@post.gmane.org> |
| References: | <CABa6CE=OFjPjomA9xQESG==MTjP9y=5UqeTgtg4fxnZjYqTEuw AT mail DOT gmail DOT com> |
| Mime-Version: | 1.0 |
| User-Agent: | Loom/3.14 (http://gmane.org/) |
| X-IsSubscribed: | yes |
cyg Simple <cygsimple <at> gmail.com> writes:
> $ 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
> Does anyone have a suggestion on turning c:\windows into c:\\windows?
$ t='c:\windows' ; tt=${t/\\/\\\\} ; echo $t $tt
c:\windows c:\\windows
Never ever use odd numbers of backslashes, when dealing with backslashes! ;^>
"\\" is the character backslash, doubled for each layer of interpretation it
has to pass thru before it gets to where it's going.
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |