home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] Odd behaviour in find

On 15-11-25 02:21 PM, Alex Pilon wrote:
>> On 15-11-25 01:39 PM, Alex Pilon wrote:
>>> Is it just me or should this work?
>>>
>>>     $ find -xdev -- foo
>>>     find: unknown predicate `--'
>>>     $
>>>
>>> But not this?
>>>
>>>     $ find -- foo -xdev -name 'sadasdasdasd'
>>>     $
>>
> On Wed, Nov 25, 2015 at 01:51:51PM -0500, Bill Strosberg wrote:
>> 'sadasdasdasd'
>>
>>
>> Sad as das DASD?    Anyone else remember an IBM DASD?  Size of a
>> refrigerator.  Could now be replaced by a USB thumbdrive.
> 
> Dummy text.
> 
> Forgot to mention.
> 
>     $ find -- sadasdasdasd
>     find: `sadasdasdasd': No such file or directory

The usage of the Unix 'find' command is this.

  find [options] [paths] [expressions]

You may optionally place '--' somewhere after [options] and before [expression] to indicate that all following arguments
are part of an expression an not an option.

If you put '--' after the first expression, it's considered another expression predicate.  I am not aware of '--' being
a valid predicate.

If you put '--' before or after the paths, but before any expressions, it's valid.

If you give a non-existing path, you will get a message the path does not exist.

This is all documented in the manual.

-- 
Stephen M. Webb  <stephen [ dot ] webb [ at ] bregmasoft [ dot ] ca>