Running a command on all file occurences in a directory tree

Fraser Campbell fraser-eicrhRFjby5dCsDujFhwbypxlwaOVQ5f at public.gmane.org
Sat Oct 9 00:43:32 UTC 2004


On Friday 08 October 2004 20:25, William O'Higgins wrote:

> Why would you escape the asterisk in the find command, by the way?

Because otherwise the shell might gobble it up before find sees it.  That does 
happen in zsh:

  shieldaig% find . -type f -name *.jpg | while read file; do
    echo $file
  done
  zsh: no matches found: *.jpg

Bash doesn't expand the * not sure why that is but careful perusal of bash and 
zsh man pages would likely explain it.  I escape out of habit, since that way 
it works in both of the shells I commonly use (zsh and bash).

-- 
Fraser Campbell <fraser-Txk5XLRqZ6CsTnJN9+BGXg at public.gmane.org>                 http://www.wehave.net/
Georgetown, Ontario, Canada                               Debian GNU/Linux

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list