cmdchallenge icon indicating copy to clipboard operation
cmdchallenge copied to clipboard

list_files example doesn't allow "ls -l"

Open est31 opened this issue 8 years ago • 7 comments

Normal GNU ls doesn't display one file per line but puts multiple files onto the same line. That's why I thought you specifically asked for ls -l but I was suprised it didn't work. Then I tried ls -l | cut -d" " -f9-, maybe you only wanted the file names, but that didn't work either.

est31 avatar Jan 28 '17 02:01 est31

Because the command you type is executed outside a terminal session (not in the javascript but executed remotely) the output comes back as a single line. You can do this explicitly in your terminal as ls -1. Seems like people are confused about this, you aren't the first one to complain so I will try to make it clearer.

jarv avatar Jan 28 '17 10:01 jarv

My first try was ls -a1 without a success.

kroomagnon avatar Jan 30 '17 08:01 kroomagnon

Think the wording could be changed a little as I found this confusing:

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

In unix terminals this command would be ls -l but that returns as an error.

My suggestion would be to change wording to:

List all of the files in the current directory

This keeps the tested command (ls) at its most basic without the confusion for experienced terminal users.

DavyJ0nes avatar Jan 30 '17 09:01 DavyJ0nes

If there are dotted files, ls alone does not lists all the files. ls -a does.

My suggestion: put some dotted files there and make it more challenging. :wink:

kroomagnon avatar Jan 30 '17 11:01 kroomagnon

+1 for this challenge is misleading.

ls (accepted answer) only lists one file per line on systems that have been configured to do so. All others, fit multiple files into each line, it also doesn't list hidden files. To match the prompt, the command should be ls -la(or -al if you prefer). Also ls -lah should be accepted since it's commonly used and fits the criteria.

AbandonedFridge avatar Feb 01 '17 21:02 AbandonedFridge

The real problem here is that there's only one file. And of course that ls is configure to print one per line by default on the machine.

0ki avatar Feb 03 '17 04:02 0ki

I fell foul of this too.

rasta-mouse avatar Feb 03 '17 07:02 rasta-mouse