cmdchallenge icon indicating copy to clipboard operation
cmdchallenge copied to clipboard

list_files challenge is wrong

Open natesilva opened this issue 8 years ago • 6 comments

Summary

In the list_files challenge, the instructions say:

# List all of the files in the current # directory, one file per line.

The expected response is ls.

This is wrong: ls does not list files one file per line. It lists multiple files per line. To list one file per line you would need the -l flag (ls -l).

Typical ls output looks like this:

root@io:/etc# ls
acpi                    fonts            ld.so.conf.d            pam.d                    shadow-
adduser.conf            fstab            legal                   passwd                   shells
aliases                 fuse.conf        libaudit.conf           passwd-                  skel
… (and so on)

Clearly that does not meet the challenge requirements.

Either change the challenge description to omit “one file per line” or change the answer to require ls -l.

Steps to reproduce

https://cmdchallenge.com/?ref=producthunt#/list_files

  1. type ls -l (the correct answer)
    • Answer not accepted.
  2. type ls (an incorrect answer)
    • Answer accepted.

natesilva avatar Feb 04 '17 20:02 natesilva

-l is also not the correct answer, so this is partially valid.

0ki avatar Feb 05 '17 12:02 0ki

I have issues too.. there is just one file in the directory or it is not working. The output says there are 24 files inside the directory?

ls -la is not accepted .. Is this correct ?

Here is my output:

bash(0)> ls -la total 24 drwxr-xr-x. 2 1000 1000 4096 Feb 6 15:21 . drwxr-xr-x. 32 1000 1000 4096 Feb 6 15:21 .. -rw-r--r--. 1 1000 1000 107 Feb 6 17:45 README

Fake4d avatar Feb 08 '17 11:02 Fake4d

24 is not the number of files. See http://stackoverflow.com/questions/7401704/what-is-that-total-in-the-very-first-line-after-ls-l

0ki avatar Feb 08 '17 12:02 0ki

Wah.. Sorry, my fault!

Fake4d avatar Feb 08 '17 13:02 Fake4d

Also acceptable and simple enough that they warrant being answers for such a beginner question:

  • ls -1 (that's one, not el)
  • find . -type f

esuomi avatar Feb 09 '17 08:02 esuomi

+1 ls is not correct if you have more than 1 file but the site accepts.

boky01 avatar Aug 21 '17 14:08 boky01