This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Unexpected results: dirs | xargs -n 1 cygpath -aw
- From: Andrey Repin <anrdaemon at yandex dot ru>
- To: Paul <Paul dot Domaskis at gmail dot com>, cygwin at cygwin dot com
- Date: Mon, 30 Sep 2013 22:26:14 +0400
- Subject: Re: Unexpected results: dirs | xargs -n 1 cygpath -aw
- Authentication-results: sourceware.org; auth=none
- References: <loom dot 20130930T180640-573 at post dot gmane dot org> <loom dot 20130930T180840-645 at post dot gmane dot org>
- Reply-to: Andrey Repin <cygwin at cygwin dot com>
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@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@yandex.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