delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/10/01/09:14:16

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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=j3lj21wnX+gfE7mG
1Lfnmq/DYPnkW1dYIm79UL9T1wOQqB/kfhVVw4J8myMGrtjO4+AemuXIYkhCe54O
0inrwV5tpJBLqdbYb/Wcjj5Tr6pC1WstTvfX0I7IK5qkbSrq4B1BQH3SK5hibUaw
SlJaA8976qfi37Qg0oi57knyjK8=
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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=jHyd1H2FT10Ss+wcsVLkSI
z2HnI=; b=O8R507QMCZZdRsnLcue/HJv9v25Z9gkM6Rq8bbob0hlhFBwVroj7QZ
qh/2Xeeb+vQaRTZT/DCqYORAOWzuA6avbDOBsfeBoWwOCpta643XYauWCXnPeYnQ
ZtiuLB70SRHjshBJ2KYxF/Z/maJiOPTISuYUl/cuHLjsxg8nej91M=
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=-0.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-qg0-f51.google.com
X-Received: by 10.140.148.203 with SMTP id 194mr12610169qhu.102.1443705232247; Thu, 01 Oct 2015 06:13:52 -0700 (PDT)
Subject: Re: Why does robocopy confuse input and output files defined with Cygwin/bash and perl?
To: cygwin AT cygwin DOT com
References: <20150930075400 DOT d50bba72719f91cdb61cd892ddf83b25 DOT 788987e5cc DOT wbe AT email11 DOT secureserver DOT net> <560BFA8D DOT 2050701 AT cs DOT umass DOT edu> <7910682845 DOT 20150930222746 AT yandex DOT ru>
From: cyg Simple <cygsimple AT gmail DOT com>
X-Enigmail-Draft-Status: N1110
Message-ID: <560D31A0.4030404@gmail.com>
Date: Thu, 1 Oct 2015 09:14:08 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0
MIME-Version: 1.0
In-Reply-To: <7910682845.20150930222746@yandex.ru>
X-IsSubscribed: yes

On 9/30/2015 3:27 PM, Andrey Repin wrote:
> Greetings, Eliot Moss!
> 
>> Dealing with "odd" characters like \ and such can be a pain, huh?
>> Perhaps it will help you to know that bash will expand variables
>> inside double-quoted arguments, i.e., "${src}".  (You can write
>> "$src" if you want, but over the years I am finding it clearer /
>> better to use the { } to make clear the name of the variable I
>> want expanded.)
> 
>> Also, you may find the cygpath utility helpful, and the $( ) idiom
>> of bash.
> 
> It isn't "idiom of bash", it is a POSIX construction.
> 
>> Thus:
> 
>> robocopy /s "$(cygpath -w /cygdrive/c/Users/siegfriend/Documents/bin)" "$(cygpath -w
>> /cygdrive/f/backup/unison/bin)"
> 
>> I believe this will do what you want.  cygpath can be very helpful
>> hen you desire to run a Windows program from the cygwin environment.
> 
> I would suggest cygpath -m.

Not for robocopy, it is likely not to survive / instead of \.  I would
prefix it with "cmd /c" though or perhaps create a bash script called
robocopy to do the path conversion before calling the Windows
robocopy.exe.  That way the command line looks typical.

-- 
cyg Simple

--
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