From owner-freebsd-questions@FreeBSD.ORG Wed Aug 5 07:36:52 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FEE21065670 for ; Wed, 5 Aug 2009 07:36:52 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 21CC48FC0A for ; Wed, 5 Aug 2009 07:36:51 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from significant-gravitas-shortfall.thebunker.net (gateway.ash.thebunker.net [213.129.64.4]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n757acFY027827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 5 Aug 2009 08:36:44 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk n757acFY027827 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1249457804; bh=6LWXL9270+OrQFLReU/4yPV0CznEnu2EgGinCST65gk=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4A79367F.8000003@infracaninophile.co.uk>|Date:=20W ed,=2005=20Aug=202009=2008:36:31=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.22=20(X11/20090727)|MIME-Vers ion:=201.0|To:=20Jay=20Hall=20|CC:=20freebsd-que stions@freebsd.org|Subject:=20Re:=20find=20question|References:=20 <42D44C8E-1E22-426C-A9AA-0FBF2A52188A@socket.net>|In-Reply-To:=20< 42D44C8E-1E22-426C-A9AA-0FBF2A52188A@socket.net>|X-Enigmail-Versio n:=200.95.7|OpenPGP:=20id=3D60AE908C|Content-Type:=20multipart/sig ned=3B=20micalg=3Dpgp-sha1=3B=0D=0A=20protocol=3D"application/pgp- signature"=3B=0D=0A=20boundary=3D"------------enigB6D269A3F869933A 679D3F0A"; b=EDn2HqeAq0rigy2A9Dq2ge5HDvnBrHJk3kw6MxKZ7XZCtcibo9aaUePpw8yn5nyTq 46CFmuAh1iB6PFeOPo1UR/rwWvXrk1REU4bF3psuSUgx8T9ZVZFfeBKmKG3otgzbcS 2aAwCTY7FwOzM5sEz/rougCrHi2Hphx0OGpTuREw= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host gateway.ash.thebunker.net [213.129.64.4] claimed to be significant-gravitas-shortfall.thebunker.net Message-ID: <4A79367F.8000003@infracaninophile.co.uk> Date: Wed, 05 Aug 2009 08:36:31 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.22 (X11/20090727) MIME-Version: 1.0 To: Jay Hall References: <42D44C8E-1E22-426C-A9AA-0FBF2A52188A@socket.net> In-Reply-To: <42D44C8E-1E22-426C-A9AA-0FBF2A52188A@socket.net> X-Enigmail-Version: 0.95.7 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB6D269A3F869933A679D3F0A" X-Virus-Scanned: clamav-milter 0.95.2 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,SPF_FAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: find question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2009 07:36:52 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB6D269A3F869933A679D3F0A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jay Hall wrote: > I am sure this is something I am doing that is obviously wrong, but I > cannot figure it out. >=20 > I am reading a list of directories from a file, and then listing all of= > the files in the directory to a file. >=20 > Here is the code. >=20 > #!/usr/local/bin/bash > cat ${FILELIST} | while read LINE > do > echo ${LINE} > `find ${LINE} -type f >> ${TMPFILE}` > done >=20 > Here is the output. > /usr/home/windowsaccess >=20 > find: illegal option -- t > find: illegal option -- y > find: illegal option -- p > find: illegal option -- e > find: f: No such file or directory >=20 > Any suggestions would be greatly appreciated. >=20 Try this as: for line in $( cat $FILELIST ) ; do echo $line find $line -type f >> $TMPFILE done *assuming that none of the directory names in $FILELIST contain spaces* This will split the contents of the file based on the current setting of = $IFS (input field separator, which usually matches any whitespace). You = can do some interesting tricks by redefining IFS... Not sure what you're trying to achieve by the backticks around your find = line -- that actually says "take the output of this command and try and run it= as a command line" which is probably not what you want. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. Flat 3 7 Priory Courtyard PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW, UK --------------enigB6D269A3F869933A679D3F0A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkp5NoYACgkQ3jDkPpsZ+VY3sgCfSK/pNwO8czOD+KsR8aeDUSvB 0OEAnjonfVQSM6682PMiycUVoOWzIynk =ZRKu -----END PGP SIGNATURE----- --------------enigB6D269A3F869933A679D3F0A--