From: Rockinghorse Winner on
What am I missing here?

[8600:/home/rh]$ find . -iname *.mp3
find: paths must precede expression: 02_-_Moonlight.mp3
Usage: find [-H] [-L] [-P] [-Olevel] [-D
help|tree|search|stat|rates|opt|exec] [path...] [expression]

[8600:/home/rh]$ cd ..

[8600:/home]$ find rh -iname *.mp3
../rh/16_-_All_Of_My_Love.mp3
../rh/104-dennis_wilson-friday_night.mp3
../rh/112-dennis_wilson-end_of_the_show.mp3
../rh/03_-_It's_Not_Too_Late.mp3
../rh/01_-_Companion.mp3

??




--
Powered by Linux 2.6.31.6-166 Fedora 12
In rotation: Pacific Ocean Blue (D. Wilson) 2.6.31.5-0.1 OpenSUSE
"Hug your cat today" 2.6.24-16 Mint Elyssa
From: Moe Trin on
On Thu, 24 Dec 2009, in the Usenet newsgroup alt.os.linux.suse, in article
<muadnZisCcijiKnW4p2dnAA(a)giganews.com>, Rockinghorse Winner wrote:

>What am I missing here?
>
>[8600:/home/rh]$ find . -iname *.mp3
>find: paths must precede expression: 02_-_Moonlight.mp3

find . -iname \*.mp3

>find rh -iname *.mp3

Not exactly sure - it should barf the same way. You're seeing
a shell expansion of the star character.

Old guy
From: ray on
On Thu, 24 Dec 2009 19:28:30 -0600, Rockinghorse Winner wrote:

> What am I missing here?
>
> [8600:/home/rh]$ find . -iname *.mp3

try this:
find . -iname "*.mp3"


> find: paths must precede expression: 02_-_Moonlight.mp3 Usage: find [-H]
> [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...]
> [expression]
>
> [8600:/home/rh]$ cd ..
>
> [8600:/home]$ find rh -iname *.mp3
> ./rh/16_-_All_Of_My_Love.mp3
> ./rh/104-dennis_wilson-friday_night.mp3
> ./rh/112-dennis_wilson-end_of_the_show.mp3
> ./rh/03_-_It's_Not_Too_Late.mp3
> ./rh/01_-_Companion.mp3
>
> ??

From: David Bolt on
On Friday 25 Dec 2009 02:39, while playing with a tin of spray paint,
Moe Trin painted this mural:

> On Thu, 24 Dec 2009, in the Usenet newsgroup alt.os.linux.suse, in article
> <muadnZisCcijiKnW4p2dnAA(a)giganews.com>, Rockinghorse Winner wrote:
>
>>What am I missing here?
>>
>>[8600:/home/rh]$ find . -iname *.mp3
>>find: paths must precede expression: 02_-_Moonlight.mp3
>
> find . -iname \*.mp3

Or wrap the *.mp3 in quotes, as suggested by Ray.

>>find rh -iname *.mp3
>
> Not exactly sure - it should barf the same way. You're seeing
> a shell expansion of the star character.

The shell expands the * if there's a match. If not, it passes it to
find as-is. So, as there's no mp3s in /home , there is no expansion
and so that one works as expected. However, there do appear to be more
than one in /home/rh and so the shell expands it to pass them all as
arguments, and so the command fails.


Regards,
David Bolt

--
Team Acorn: www.distributed.net OGR-NG @ ~100Mnodes RC5-72 @ ~1Mkeys/s
openSUSE 11.0 32b | | openSUSE 11.2 32b |
openSUSE 11.0 64b | openSUSE 11.1 64b | openSUSE 11.2 64b |
TOS 4.02 | openSUSE 11.1 PPC | RISC OS 4.02 | RISC OS 3.11
From: Rob on
houghi <houghi(a)houghi.org.invalid> wrote:
> ray wrote:
>> On Thu, 24 Dec 2009 19:28:30 -0600, Rockinghorse Winner wrote:
>>
>>> What am I missing here?
>>>
>>> [8600:/home/rh]$ find . -iname *.mp3
>>
>> try this:
>> find . -iname "*.mp3"
>
> That is indeed the way to do it with find.
>
> I never botherd to find out why, because it works if you do add the ""
> around it. Even if someone would explain exactly why, I would most
> likely not understand it anyway, it won't change anything and will
> confuse more then resolve. Obviously that goes only for me.

This means you have a fundamental misunderstanding about how wildcard
filename expansion works in Linux and other Unix versions.
Probably you come from the MSDOS world, where this works differently.

It is properly explained in most shell manual pages.
 |  Next  |  Last
Pages: 1 2 3
Prev: /var/log/kdm.log file now 7.3GB HELP
Next: almost luck