Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <42F510B1.947D717C@dessent.net> Date: Sat, 06 Aug 2005 12:34:09 -0700 From: Brian Dessent MIME-Version: 1.0 To: list Cygwin Subject: Re: Question about coreutils common option "-" References: <20050806191127 DOT 35121 DOT qmail AT web30208 DOT mail DOT mud DOT yahoo DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Report: -5.7/5.0 ---- Start SpamAssassin results * -3.3 ALL_TRUSTED Did not pass through any untrusted hosts * -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] * 0.2 AWL AWL: From: address is in the auto white-list ---- End SpamAssassin results X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Peter Farley wrote: > I thought the following would produce "ls -l" output > for the space-separated list of files selected by the > "find" options, but instead I get an error message > from "ls": > > $ find a -daystart -type f -mtime 7 -printf " %p"|ls > -l - > ls: -: No such file or directory > > The output from the "find" looks like this: > > $ find a -daystart -type f -mtime 7 -printf " %p" > a/list.txt a/list_0002.txt I've never heard of using '-' to ls this way. The coreutils info page does list it as a common flag, but my interpretation of the language there is that it's only referring to programs that act as input/output filters, not as a general-purpose way of passing filename arguments. That's why xargs exists. You can get ls-like output from find without any other programs: find a -daystart -type f -mtime 7 -ls If you must use an external program, the usual way to take the output from find and send it as arguments is with xargs: find a -daystart -type f -mtime 7 | xargs ls -l Note that both this and your '-printf " %p"' method will not work for filenames that contain spaces or special characters. Therefore the superior way of doing this is: find a -daystart -type f -mtime 7 -print0 | xargs -0 ls -l > I do not have an *ix system on which to test if this > is a Cygwin coreutils problem or a misunderstanding by > me of the operation of the "-" option. Can you please > tell me if I am wrong about my use of the "-" option? It doesn't work under linux either. (It's the same coreutils code in either case.) Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/