Add documentation on find command for Unix newcomers#390
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.
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.
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.
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.
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.