[ALUG] Re: Problem with 'find' and 'basename'
Chris G
cl at isbd.net
Fri Jun 8 13:44:17 BST 2007
On Fri, Jun 08, 2007 at 12:37:22PM +0100, MJ Ray wrote:
> Chris G <cl at isbd.net> wrote:
> > find info -name '*.txt' -exec echo `basename {} .txt` \;
>
> I think the backticks are run by the shell before find.
>
> Try:
>
> find info -name '*.txt' | while read filename ; do
> mv -v "$filename" "${filename/%.txt/.rst}"
> done
>
In the end I just wrote the output of find to a file and then edited
the file to a series of mv commands and ran that.
The issue is definitely that bash parses the `` before the find is
run.
--
Chris Green
More information about the main
mailing list