From owner-freebsd-questions Mon Oct 26 09:22:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA01292 for freebsd-questions-outgoing; Mon, 26 Oct 1998 09:22:51 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from phoenix.volant.org (phoenix.volant.org [205.179.79.193]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA01287 for ; Mon, 26 Oct 1998 09:22:49 -0800 (PST) (envelope-from patl@phoenix.volant.org) From: patl@phoenix.volant.org Received: from asimov.phoenix.volant.org ([205.179.79.65]) by phoenix.volant.org with smtp (Exim 1.92 #8) id 0zXqLN-0003Kv-00; Mon, 26 Oct 1998 09:22:13 -0800 Received: from localhost by asimov.phoenix.volant.org (SMI-8.6/SMI-SVR4) id JAA10477; Mon, 26 Oct 1998 09:22:10 -0800 Date: Mon, 26 Oct 1998 09:22:10 -0800 (PST) Reply-To: patl@phoenix.volant.org Subject: Re: find... pilot error? To: Studded cc: Jason McNew , questions@FreeBSD.ORG In-Reply-To: <3634287A.1900A74E@gorean.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Jason McNew wrote: > > > > After reading the find man page, I tried using: > > find / -name "*.mp3" -exec mpg123 {}; > > and it tells me: > > find: -exec: no terminating ";" > > if I do: > > find / -name "*.mp3" -exec mpg123 {}\; > > it runs ok, but mpg123 just gives me syntax help a few times. > > So, I tried: > > find / -name "*.mp3" -exec echo {}\; > > and it just spits out a bunch of blank lines. > > Although: > > find / -name "*.mp3" -print > > works exactly how i'd expect it. Your shell might be doing something special with the braces. Try various other forms of quoting. > I don't know what mpg123 expects as an argument, but in a case like > this I fall back on my shell. Assuming you're using Bash or sh, this > should work: > > for FILE in `find / -name '\*.mp3'`; do > mpg123 $FILE > done I like to use xargs with find. For simple cases, it seems cleaner than the equivalent for loop. If mpg123 can take more than one filename on the command line, try: find / -name '*.mpg3' -print | xargs mpg123 If it only takes one, make that: find / -name '*.mpg3' -print | xargs -n 1 mpg123 And, finally, if you expect any of the filenames may contain whitespace, try: find / -name '*.mpg3' -print0 | xargs -0 -n 1 mpg123 -Pat To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message