On Mon, 25 Mar 2002 19:24:55 +0100 James Mohr <suse_mailing_list@jimmo.com> wrote:
On Monday 25 March 2002 13:39, zentara wrote:
On Sun, 24 Mar 2002 21:39:38 +0100
Philipp Thomas <pthomas@suse.de> wrote:
On Sun, 24 Mar 2002 09:17:24 -0500, you wrote:
Ok, that is just a simple use of find find . -name "*.jpg" ;;
Nope, that won't keep the shell from expanding the wildcard. Either use single quotes or a backslash to inhibit wildcard expansion:
find <directory_to_start_searching> -name \*.jpg find <directory_to_start_searching> -name '*.jpg'
Hmmm, find . -name "*.jpg" works for me with output identical to \*.jpg or '*.jpg' . Wonder why? I'm using bash from suse7.2.
It's standard shell behaviour. Expansion of the wildcards is done by the shell before it tries to execute the command. If you have a file in the current directory ending in jpg then the shell finds it and expands it on the command line. If there is no file that the shell can expand to the entire expression is passed to find. You can test this with the exact same command, but first create a jpg file in the current directory (touch trash.jpg). Then you will only find that one file (or any other file with the exact same name.)
Yeah, I understand shell behavior with *. The original posts dealt with whether using "" quotes would work. They do on my system, for example, the following give identical output, whether I use "" , '' , or \ zentara@zentara:~/1 > ls dobears.jpg flag.jpg frontpage.bmp hula.gif linus.jpg linus1.jpg mscement.png oldglory.ps trash.jpg tuxvolt_a.gif zentara@zentara:~/1 > find . -name "*.jpg" ./trash.jpg ./linus1.jpg ./flag.jpg ./linus.jpg ./dobears.jpg zentara@zentara:~/1 > find . -name '*.jpg' ./trash.jpg ./linus1.jpg ./flag.jpg ./linus.jpg ./dobears.jpg zentara@zentara:~/1 > find . -name \*.jpg ./trash.jpg ./linus1.jpg ./flag.jpg ./linus.jpg ./dobears.jpg zentara@zentara:~/1 > -- $|=1;while(1){print pack("h*",'75861647f302d4560275f6272797f3');sleep(1); for(1..16){for(8,32,8,7){print chr($_);}select(undef,undef,undef,.05);}}