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

Add documentation on find command for Unix newcomers #390

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

Conversation

theNerd247
Copy link

No description provided.

--
-- > find "foo.txt" "./bar"
--
-- will return only a single filepath: @./bar/foo.txt@. To search for a
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is correct? Wouldn't you need to search for the exact string "./bar/foo.txt" to match that path?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh your right! It was originally find "foo.txt" "." and then I went back and updated.

-- will return only a single filepath: @./bar/foo.txt@. To search for a
-- filename in a similar manner to GNU find do something similar to:
--
-- > find (suffix $ "/" *> "foo.txt") "./bar"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the "/" for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "/" is the file separator for a file path. The intent is to match against ./bar/foo.txt so suffix would match the ./bar then "/" then the file name. I realize though that if one were to have "." as the search-tree root then immediate children ("./foo.txt") wouldn't match. It might have been better to have something like basename "foo.txt" :: Pattern FilePath"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I asked is because find still returns the full name of the path, so I think the closer match to find would be something like:

find (chars <> "/" <> "foo.txt")

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