Re: bash script question
On Mon, 2003-05-05 at 17:41, Kevin McKinley wrote:
> On 05 May 2003 17:19:04 +0100
> Oliver Elphick <olly@lfix.co.uk> wrote:
>
> > On Mon, 2003-05-05 at 16:29, Rudy Gevaert wrote:
> > > Hallo,
> > >
> > > I have a directory with files, and in every file I want to replace:
> > > templates/images
> > > with
> > > http://users.pandora.be/webworm/images
> > >
> > > How can I do this in an easy way?
> >
> > cd directory
> > for f in `find . -type f`
> > do
> > sed -e 's|templates/images|http://users.pandora.be/webworm/images|g' $f
> > >$$
> > cat $$ >$f # do it this way to preserve existing ownership and perms
> > done
> > rm $$
>
> Can the "for" line be replaced with
>
> for f in *
Yes
> What would be the difference, except being simpler and not using find? :)
If there are any directories, it will barf on them. With find, it will
descend into them instead.
If you know there are none, "for f in *" is fine.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Do not repay anyone evil for evil. Be careful to do
what is right in the eyes of all men."
Romans 12:17
Reply to: