[Novalug] find or not really or?
shawn wilson
ag4ve.us@gmail.com
Tue May 19 11:23:02 EDT 2015
On Tue, May 19, 2015 at 10:51 AM, Richard Rognlie <rrognlie@gamerz.net> wrote:
> I think this is a function of -or having a lower precedence than the implied "and"
>
>
> if the or is related to the type type being either a link or a file, then the answer is
>
> % find $HOME -maxdepth 1 \( -type f -or -type l \) -iname "*rc" -print0 | wc -c
That seems like the way to go (though, as I showed - putting the -or'd
stuff at the end seems to work the same). I'm guessing it reads
logically right to left (generally - you'll notice puting -maxdepth
after most things causes an error for instance).
>
> On Tue, May 19, 2015 at 10:47:43AM -0400, William Sutton via Novalug wrote:
>> no idea, but just for giggles, what's the difference between the two
>> if you omit the |wc -c, replace it with |sort, cat it to a pair of
>> files, and vimdiff the files?
>>
The point was to show a difference (didn't see the need to post what
rc files I have on GP). However, it seems to stop at the first symlink
or file depending on order.
mkdir temp; cd temp
for i in ab cd ef; do
file="${i:0:1}"
link="${i:1:2}"
touch "$file"
ln -s "$file" "$link"
done
and test (that code is untested)
More information about the Novalug
mailing list