-
Notifications
You must be signed in to change notification settings - Fork 90
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
base: main
Are you sure you want to change the base?
Conversation
-- | ||
-- > find "foo.txt" "./bar" | ||
-- | ||
-- will return only a single filepath: @./bar/foo.txt@. To search for a |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the "/"
for?
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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")
No description provided.