-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1725,6 +1725,15 @@ inplaceWith sed_ pattern' file = liftIO (runManaged (do | |
mv tmpfile file )) | ||
|
||
-- | Search a directory recursively for all files matching the given `Pattern` | ||
-- Note: The `Pattern` matches against the full path of a file as opposed to | ||
-- just the base name as in GNU find. For example: | ||
-- | ||
-- > find "foo.txt" "./bar" | ||
-- | ||
-- 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 commentThe reason will be displayed to describe this comment to others. Learn more. What is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason I asked is because find (chars <> "/" <> "foo.txt") |
||
find :: Pattern a -> FilePath -> Shell FilePath | ||
find pattern' dir = do | ||
path <- lsif isNotSymlink dir | ||
|
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.