[ALUG] Problem with 'find' and 'basename'

MJ Ray mjr at phonecoop.coop
Fri Jun 8 12:37:22 BST 2007


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

Hope that helps,
-- 
MJ Ray - see/vidu http://mjr.towers.org.uk/email.html
Experienced webmaster-developers for hire http://www.ttllp.co.uk/
Also: statistician, sysadmin, online shop builder, workers co-op.
Writing on koha, debian, sat TV, Kewstoke http://mjr.towers.org.uk/



More information about the main mailing list