Re: getting rid of the path

From: Toshi (toshi_at_lemon.com)
Date: 09/04/03


Date: Wed, 03 Sep 2003 20:40:19 -0400

Chris F.A. Johnson wrote:

> On Wed, 03 Sep 2003 at 21:55 GMT, Toshi wrote:
>
>>Since the file paths are in a file, I tried to redirect that files to
>>baseanme and redirect it to another file (because it is my ultimate
>>goal. It didn't work. So I tried :
>>
>>for f in filewithpath ; do basename "$f" >> filewitoutpath ; done
>>
>>same error
>>
>>usage: basename string [suffix]
>>
>>What is the right way?
>
>
> while read f
> do
> basename "$f" ## or: echo ${f##*/}
> done < filewithpath > filewithoutpath

It does work! By the way I don't understand the meaning of those
" ##"

I know that loops are known to be slow. Is there a way to do without them?

Thank you in advance!