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: List-Subscribe: List-Archive: List-Post: List-Help: , 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 Subject: Re: sed anomaly in bash script Date: Sat, 15 Nov 2014 04:40:59 +0000 (UTC) Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes cyg Simple gmail.com> writes: > $ TEST=`echo 'c:\windows' | sed -e s.\\.\\\\.g` > $ echo $TEST > c:\\windows > > TEST=`echo 'c:\windows' | sed -e s.\\\.\\\\\.g' > echo $TEST > > $ 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