aheckmann / m

mongodb version management
MIT License
267 stars 55 forks source link

Use -(min|max)depth in find instead of -depth #72

Closed dgomezferro closed 2 years ago

dgomezferro commented 2 years ago

-depth N is only supported in BSD, -min/maxdepth seems to be supported everywhere. Placing them before other options also removes a warning:

$ find /home/ubuntu/.local/m/versions -type d -depth
find: warning: you have specified the -depth option after a non-option argument -type, but options are not positional (-depth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.

find: paths must precede expression: `1'
$ find /home/ubuntu/.local/m/versions -maxdepth 1 -mindepth 1 -type d
/home/ubuntu/.local/m/versions/5.0.5
/home/ubuntu/.local/m/versions/5.2.0-rc2
/home/ubuntu/.local/m/versions/5.1.1
stennie commented 2 years ago

Thanks @dgomezferro ! BSD-ish options are generally there to be friendly with macOS' ancient userland tools, but min/maxdepth also appear to be work fine :)

Cheers, Stennie