[PLUG] New desktop: issue with 'find'

wes plug at the-wes.com
Thu Oct 4 12:23:10 PDT 2018


On Thu, Oct 4, 2018 at 11:23 AM Rich Shepard <rshepard at appl-ecosys.com>
wrote:

> On Thu, 4 Oct 2018, wes wrote:
>
> > Hopefully someone recognizes this error and can help, it's not one I've
> > seen before. Would you please provide a real-world example, and its
> > complete output? And also the output of find --version?
>
> wes,
>
>    On the new desktop:
>
> [root at baetis ~]# find / -name stripes.png
> find: paths must precede expression: /
> Usage: find [-H] [-L] [-P] [-Olevel] [-D
> help|tree|search|stat|rates|opt|exec] [path...] [expression]
>
>
>
For whatever reason, only now did this trigger the memory: didn't you talk
about making an alias for find to add some parameter by default?

Yes, here we are:

>On Sun, 30 Sep 2018, David Fleck wrote:
>
>> Not exactly what you want, but you can specify file system type with
>> -fstype xxx. Anything in /proc is fstype 'proc', so maybe you could
>> specify "! -fstype proc" as one of your sets of arguments to find.
>
>David,
>
>  This looks like it will do the job. I'll use this in an alias so it's the
>default for find.

And indeed, I can reproduce this:

$ find ! -fstype proc / -name stripes.png
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

Unfortunately an alias can only be used to add items to the _beginning_ of
a given command. There is no support for inserting something into the
middle. Bash includes "functions" which does offer this option, though it's
somewhat more complicated to enact.

-wes


More information about the PLUG mailing list