find only works from /root ???

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed Oct 11 05:47:17 UTC 2006


On Wed, 11 Oct 2006, Walter Dnes wrote:

>  I have PS1 (the prompt) set to [machine][user][cwd]
>
>  I try to find all pdf files in my account...
>
> [m3000][waltdnes][~] find /home/waltdnes/ -iname *.pdf
> find: paths must precede expression
> Usage: find [-H] [-L] [-P] [path...] [expression]

    Quote the pattern to prevent expansion by the shell:

find /home/waltdnes/ -iname '*.pdf'

>  Alright, let's try it as root from my regular user directory...
>
> [m3000][root][/home/waltdnes] find /home/waltdnes -iname *.pdf
> find: paths must precede expression
> Usage: find [-H] [-L] [-P] [path...] [expression]
>
>  Now from /root...
>
> [m3000][root][/home/waltdnes] cd
> [m3000][root][~] find /home/waltdnes -iname *.pdf
> /home/waltdnes/zz/sandvine.pdf
> /home/waltdnes/zz/google.pdf
> blah, blah, blah, bunch of files listed...
>
>  What am I doing wrong?  Same syntax, different results!?!?

     If you don't have any matching files in the current directory, the
     pattern will be passed unchanged to find.

-- 
    Chris F.A. Johnson                      <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list