delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/09/30/14:35:25

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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=FUF7U2op6Ll7J73M
rQ7qT4X0jIVOO7a6ZQ47XEa1fwRtuOOtOjxrsp3rQp9+f+MsFBu5huzjSeTiFwtQ
URKebeI2/Eypo9wHbygP0dlIUBoB8Q8u6S/HCC4GsnUzSZXyZKlVkaeAC7z9KukO
xt+At4/FjUp3BZ7Tcid6b40tb0U=
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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=5HBwbiOO9q0sxDI3rpSh+F
lEfO8=; b=xAqjEZ8yY/cpj62EtpxgIjmlwXPd1F+Yx2Rn4IkCV30TUKiwD6llie
9VBHxM06WUtbRFObDRxbWWS6XRj/ry1U6J1iS4JMVENNMIZUJw4qDEPTnGs0rsKR
jNuy9wEaZzwuL3IYua0yLA0GxIDkjx6hW9LYOyDbWXetTlNZLMF5k=
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: Yes, score=5.9 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,HELO_LH_HOME,KAM_THEBAT,RDNS_NONE autolearn=no version=3.3.2
X-HELO: smtp.ht-systems.ru
Date: Mon, 30 Sep 2013 22:26:14 +0400
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <1255057745.20130930222614@mtu-net.ru>
To: Paul <Paul DOT Domaskis AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: Unexpected results: dirs | xargs -n 1 cygpath -aw
In-Reply-To: <loom.20130930T180840-645@post.gmane.org>
References: <loom DOT 20130930T180640-573 AT post DOT gmane DOT org> <loom DOT 20130930T180840-645 AT post DOT gmane DOT org>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Paul!

> Sorry, this is a re-post.  I did not completely sanitize the last post, 
> leading to inconsistent info.  Unfortunately, I can't edit or retract a 
> post from a mailing list.  Here is the self-consistent post:

> I'm doing something wrong with xargs.  If I simply use "cygpath -aw" with 2 
> arguments, it works fine:

>    $cygpath -aw ~/projects/project1 ~/projects/project2

>       C:\cygwin\home\UserName\projects\project1
>       C:\cygwin\home\UserName\projects\project2

> If I use "xargs -n 1" with echo, it works fine:

>    $dirs | xargs echo

>       ~/projects/project1 ~/projects/project2

>    $dirs | xargs -n 1 echo

>       ~/projects/project1
>       ~/projects/project2

> However, if I use xargs with cygpath, it doesn't:

>    $dirs | xargs -n 1 cygpath -aw

>       C:\cygwin\home\UserName\projects\project1\~\projects\project1
>       C:\cygwin\home\UserName\projects\project1\~\projects\project2

> Thanks if anyone can explain what I'm doing wrong.

First of all, your problem is that you're using "dirs". Tilde expansion is
done by shell before command is executed, it is not done by xargs, or cygpath.
Replacing "dirs" with "ls" in your command gave me the desired results.

AnrDaemon AT daemon2 ~/cr3
$ ls | xargs -n 1 cygpath -aw
C:\home\Daemon\cr3\bookmarks
C:\home\Daemon\cr3\cache
C:\home\Daemon\cr3\cr3hist.bmk


--
WBR,
Andrey Repin (anrdaemon AT yandex DOT ru) 30.09.2013, <22:20>

Sorry for my terrible english...


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