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

Files vs symlinks #131

Open
discoltk opened this issue Apr 7, 2017 · 9 comments
Open

Files vs symlinks #131

discoltk opened this issue Apr 7, 2017 · 9 comments

Comments

@discoltk
Copy link

discoltk commented Apr 7, 2017

Being a test of unix command line proficiency, I took the instructions literally. I was surprised to find that when you refer to files below the current directory, you're actually talking about symbolic links to files located elsewhere. I think the instructions should be accurate.

@jarv
Copy link
Owner

jarv commented Apr 7, 2017

Thanks for the feedback, I will look at improving the description. In the meantime feel free to submit a PR against https://github.com/jarv/cmdchallenge/blob/master/challenges.yaml if you would like to improve it yourself.

@discoltk
Copy link
Author

discoltk commented Apr 7, 2017

Is it intentional that the files are symlinks? Making them be files instead of symlinks would make the challenge description accurate without changing the wording.

@jarv
Copy link
Owner

jarv commented Apr 7, 2017

If we are talking about this challenge https://github.com/jarv/cmdchallenge/blob/master/challenges.yaml#L177 then it is using the general term file to refer to everything, directories, symlinks, etc. which is not wrong though I agree it could be confusing. Maybe we should change the description to simply say:

      Delete the entire contents of this challenge
      directory recursively.

@discoltk
Copy link
Author

discoltk commented Apr 7, 2017

Actually it was "search for string in files recursive" that I noticed it.
find . -type f -name "access.log*" -exec egrep string {} \;

Didn't return anything, because its a symlink, not a file. It says to search through the files in the current directory, and even hints that its in a nested directory, but there literally are no files, only symlinks to files elsewhere. Unless there is a reason they're symlinks, I'd just make them actual files and then the description is accurate.

# Print all matching lines (without the filename
# or the file path) in all files under the current
# directory that start with "access.log" that
# contain the string "500". Note that there are no
# files named "access.log" in the current directory,
# you will need to search recursively.

@mrquincle
Copy link
Contributor

mrquincle commented Apr 30, 2017

Yes, it is a bit confusing.

find -L . -type f -name "access.log*" -exec egrep string {} \;

Will - with the -L flag - act like you expect. I think in the ideal case there are a few files and a few symlinks, so people realize they might have missed the latter if they always blindly apply find as is.

@discoltk
Copy link
Author

discoltk commented May 1, 2017 via email

@mrquincle
Copy link
Contributor

@discoltk
Copy link
Author

discoltk commented May 1, 2017 via email

@mrquincle
Copy link
Contributor

mrquincle commented May 1, 2017

That might have been reasonable (there is an underlying inode). :-) However, fifos were not present in the assignment.

Apart from all this, I think you're right with suggesting a more crisp description of what to do.

"Find all the (linked) files ..." would also be sufficient.

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

No branches or pull requests

3 participants