On Wed, Mar 22, 2000 at 10:43:16AM +1000, Steve Youngs wrote:
> 
> Looks good, Greg, but it didn't work for me.  I tested it by
> substituting the cat lala and mv lala lines with a 'echo $FILE'...
> 
> Result.  Only the first file in the directory was listed.  But it was
> listed the same number of times that there were files in the
> directory. :-)
>
doops. I meant to put the FILE=$1 inside the while loop.
So this should work. (Like you don't have enough solutions already :-) )
=================================
#! /bin/bash

LOOP_TIMES=$# 
LOOP=1 
TMPFILE=$(mktemp /tmp/tmp.XXXXX) 
if [ $? != 0 ] then
        echo "Couldn't get temp file" exit 1
fi

while [ $LOOP -le $LOOP_TIMES ]; do
        FILE=$1
        cat $FILE | tr "\r" "\n" > $TMPFILE 
        mv $TMPFILE $FILE 
        shift
        LOOP=$[ LOOP + 1 ]
done 
============end=================
have fun,

greg

--
<this space for rent>

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to