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 starting with u number does not accept valid solution #146

Open
codesinthedark opened this issue Jul 5, 2017 · 2 comments
Open

files starting with u number does not accept valid solution #146

codesinthedark opened this issue Jul 5, 2017 · 2 comments

Comments

@codesinthedark
Copy link

codesinthedark commented Jul 5, 2017

basename -a $(find . -type f) | grep ^[0-9]
is not accepted as a solution but it outputs the same lines as accepted solution: ls -R|grep ^[0-9]|grep -v dir

Only difference that the lines are in different order and in the exercise it is not specified that we need a specific order. For example ls -U would not work because it traverses the files in directory order.

Also the accepted solution should not be accepted because if directories do not contain "dir" it would not work while basename -a $(find . -type f) | grep ^[0-9] would work.

Edit: not an issue

@jarv
Copy link
Owner

jarv commented Jul 6, 2017

It breaks on files with spaces so the failure is expected here:

bash(0)> basename -a $(find . -type f) 
42Robert
Hill
540Katherine
Jones
639Charles
Ferguson
593Brett
Martin
Mr.
James
Lopez
04Carrie
Alexander
132Rebecca
Rubio
477Thomas
Pierce
MD
388Andrew
Carter
335John
Joseph
974Michael
Bowman
48Thomas
Allen
Sheri
Bishop
737Jeffrey
Davis
Jorge
Ross
README
Matthew
Romero
293Linda
Bennett
436Teresa
Owens
78Michelle
Spencer
25Brandon
Mcdonald
provident.avi
99blanditiis.avi
sit.avi
nisi.avi
totam.avi
682Terri
Jones
778Holly
Archer
exercitationem.mp3
3maxime.mp3
402Nancy
Henson
757Robert
Marquez
511Tammy
Welch
670James
Jacobs
tmp

@codesinthedark
Copy link
Author

You are correct. If I try find . -type f | while read fname; do basename "$fname" | grep ^[0-9]; done
then it works :)
Thank you 👍

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

2 participants