Jay Hall wrote:
> I am sure this is something I am doing that is obviously wrong, but I
> cannot figure it out.
> I am reading a list of directories from a file, and then listing all of
> the files in the directory to a file.
> Here is the code.
> #!/usr/local/bin/bash
>         cat ${FILELIST} | while read LINE
>         do
>                 echo ${LINE}
>                 `find ${LINE} -type f >> ${TMPFILE}`
>         done
> Here is the output.
> /usr/home/windowsaccess
> find: illegal option -- t
> find: illegal option -- y
> find: illegal option -- p
> find: illegal option -- e
> find: f: No such file or directory
> Any suggestions would be greatly appreciated.

Try this as:

    for line in $( cat $FILELIST ) ; do
        echo $line
        find $line -type f >> $TMPFILE

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



Dr Matthew J Seaman MA, D.Phil.                       Flat 3
                                                      7 Priory Courtyard
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW, UK

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to