Skip to content

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

Description

@codesinthedark

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

Activity

  1. jarv commented on Jul 6, 2017

    @jarv
    Owner

    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
    
  2. codesinthedark commented on Jul 7, 2017

    @codesinthedark
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions