Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: /proc slows % echo /**/*/etc/r*(/N)



/^proc. will match everything except /proc, so you can easily look for files like /^proc/**/whatever. 

But on my system which has no /proc, `**` is just as much a culprit, since that does a recursive search throughout the entire file system. For instance, /**/etc matches /`foo/bar/baz/zoo/wicky/etc` and so on...

On Sun, Jan 21, 2024 at 12:20 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
I used to do this kind of thing without any problems:

     % echo /**/*/etc/r*(/N)

... but just trying it, zsh labors for close to an hour, then spits out
countless pages of:

/proc/9/root/etc/rc0.d /proc/9/root/etc/rc1.d /proc/9/root/etc/rc2.d
/proc/9/root/etc/rc3.d /proc/9/root/etc/rc4.d /proc/9/root/etc/rc5.d
/proc/9/root/etc/rc6.d /proc/9/root/etc/rcS.d /proc/9/root/etc/rsyslog.d
/proc/9/task/9/cwd/etc/rc0.d /proc/9/task/9/cwd/etc/rc1.d
/proc/9/task/9/cwd/etc/rc2.d /proc/9/task/9/cwd/etc/rc3.d
/proc/9/task/9/cwd/etc/rc4.d /proc/9/task/9/cwd/etc/rc5.d
/proc/9/task/9/cwd/etc/rc6.d /proc/9/task/9/cwd/etc/rcS.d
/proc/9/task/9/cwd/etc/rsyslog.d /proc/9/task/9/root/etc/rc0.d
/proc/9/task/9/root/etc/rc1.d /proc/9/task/9/root/etc/rc2.d
/proc/9/task/9/root/etc/rc3.d /proc/9/task/9/root/etc/rc4.d
/proc/9/task/9/root/etc/rc5.d /proc/9/task/9/root/etc/rc6.d
/proc/9/task/9/root/etc/rcS.d /proc/9/task/9/root/etc/rsyslog.d

... I'm wondering why /proc wasn't a problem previously and if there's
anything I can do to filter it out of the search -- probably all the
Linux 'system' directories too.  I recall that there's some test,
something in permissions, some flag -- that identifies these
not-quite-real directories -- zsh knows who they are.  They're really in
RAM, yes?  I know the tilde is used to make exceptions:

     for bb in *.eml~save*; do

... all files matching '*.eml' excepting those that match 'save*' ...
but I can't get the syntax correct with the above.

     % echo /**/*/etc/r*~/proc*(/N)

     % echo /**/*/etc/r*(/N)~/proc*

... were busts.  But the right answer is to filter out all those virtual
directories.  Don't know why this didn't used to be a problem.  But I
think I did deal with this issue a few years ago, too.






--
Mark J. Reed <markjreed@xxxxxxxxx>


Messages sorted by: Reverse Date, Date, Thread, Author