Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove depth from find invocation #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bouzomgi
Copy link

@Bouzomgi Bouzomgi commented Apr 20, 2024

Shelm currently uses the depth argument in a find call. This argument exists in the macOS implementation of find, but does not in Linux implementations. This PR replaces this argument with a filter of all paths removing any that do not include 3 slashes, equivalent to the "--depth 3" argument that currently exists. Because grep will fail if this filter does not return a result, I've added a fallback in || : to ensure the function returns nothing if no directories are found, just like the existing script.

Basically, this change allows shelm to work on both macOS and Linux.

I've tested this implementation on macOS and an Alpine image, and fetch and make both work the same as how the code exists currently.

@vjousse
Copy link

vjousse commented Sep 11, 2024

Replacing -depth 3 with -maxdepth 3 -mindepth 3 does the trick for me on Linux (and it seems that those parameters exist on macOS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants