> You should support bash's double-star wildcard, which works recursively
It depends on what the educational goals are, but alternatively OP could swing on the opposite direction and go with a very vanilla POSIX sh style shell (maybe dash) to discourage bashisms.
I might of course be bit biased because `find` is one of my favorite utils (generally with -exec instead of -print0|xargs -0) and I practically never use newfangled doublestar globbing
Re:Show HN: Command Line Challenge
by JoshTriplett on Thursday January 26, 2017 @03:56PM
(#13495181)
Teaching efficient bash usage and teaching portable shell scripting seem related but distinct. This challenge specifically mentions that it uses bash.
Yes sure, I wasn't trying to say that going full bash is a bad thing. I was merely presenting an alternative.
Ah good point, the commands are run in a bash 4 subshell actually but by default the globstar option is off.
globstar is on by default now so this will work.
> I really like this; reminiscent of the Python Challenge, but for shell.
> You should support bash's double-star wildcard, which works recursively. Several of the challenges that currently require
> find -name 'access.log' -print0 | xargs -0 somecommand
> could just use
> somecommand /access.log
This challenge was where I stopped, and for this exact reason. Then again, I am a zsh user, so maybe I'm spoiled...
I stopped after 'Print the relative file paths, one path per line for all files that start with "access.log" in the current directory.' It didn't like my BSD find options.
Re:Show HN: Command Line Challenge
by JoshTriplett on Friday January 27, 2017 @04:02AM
(#13498585)
> It didn't like my BSD find options.
Which options, specifically?
You can use
shopt -s globstar
and **/access.log*
works just it would in bash :)
Re:Show HN: Command Line Challenge
by JoshTriplett on Friday January 27, 2017 @04:03AM
(#13498587)
I actually submitted a PR upstream, and the author merged it and deployed it, so cmdchallenge.com now has globstar enabled.
You should support bash's double-star wildcard, which works recursively. Several of the challenges that currently require
could just use instead.You might also encourage people to look up manpages. For instance, someone who doesn't know about "grep -h" may want to look at the manpage for grep. You could make "man grep" link to http://man7.org/linux/man-pages/man1/grep.1.html .
Tab completion doesn't always include all files; for instance, it doesn't include split-me.txt
Have you considered logging all unique successful solutions (filtering out minor whitespace differences) to each challenge? That would let people who have completed each challenge see other potential approaches to the problem, and perhaps learn about new commands.