Steve Youngs wrote:
> 
> Hey People
> 
> I'm having a problem with a bash shell script that I'm hoping someone
> here can help me with.
> 
> The script is supposed to convert ^M to ^J in all the files in a
> directory.  The script is invoked with 'scriptname *'.  The thing that
> I just can't nut out is how to increment the variable that represents
> the filename.
> 
> Here's what I have..
> 
> ,----[ Le Script ]
> | #! /bin/bash
> |
> | LOOP_TIMES=$#
> | LOOP=1
> | FILE=$1
> |
> | while [ $LOOP -le $LOOP_TIMES ]; do
> |     cat $FILE | tr "\r" "\n" > $FILE
> |     somehow increment $FILE from $1 to $2, $3, $4 etc up to $#
> |     LOOP=$[ LOOP + 1 ]
> | done
> `----
> 
> I know the answer will be something really simple and easy, I just
> can't think of it. :-(
> 
> --
> |---<Regards, Steve Youngs>-------------------------------------|
> |     It's a funny thing about life; if you refuse to accept    |
> |          anything but the best, you very often get it         |
> |------------------------------------<[EMAIL PROTECTED]>---|
> 
> -
> 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

I would like to prefere something like the following script:
#!/bin/sh
for FILE in `ls`
do
        echo $FILE
        # do here your tr - statement
done
-- 
MfG Alfred Frank, Wien.

-
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