cmdchallenge icon indicating copy to clipboard operation
cmdchallenge copied to clipboard

A `./` prefix should be allowed on output for the `grep -l` challenge

Open mikeweilgart opened this issue 6 years ago • 0 comments

Regarding challenge: https://cmdchallenge.com/#/search_for_files_by_extension

The most obvious answer to this challenge is grep -l 500 *, however, this is a bad practice as it will not handle files named beginning with a hyphen. Please see https://www.defensecode.com/public/DefenseCode_Unix_WildCards_Gone_Wild.txt for examples of how the naked wildcard * can be exploited in various ways.

The correct, best practice answer to the challenge is either grep -l 500 -- * or grep -lR 500 . or grep -l 500 ./*. The latter two answers produce a list of all the appropriate files, but each is prefixed with ./, so the challenge currently doesn't accept these as solutions.

I think the criteria should be modified to allow ./ as a prefix to all files.

mikeweilgart avatar Dec 05 '18 01:12 mikeweilgart