http://mywiki.wooledge.org/ParsingLs
If you guessed "how to actually get a list of files in a single directory", you win the prize!
For the record, this is what I've come up with:
find dir -maxdepth 1 -name 'somefilter' -printf "%f\n"
If you don't want newlines, replace it with \0 for maximum protection against Unix shell fuckwittery.
But what is even stupider than Bash is this Comic Book Guy bullshit linked on the page. Even in their cherry picked examples there are opportunities to teach something interesting, but they'd rather whine about stupid people asking the wrong question than the one that matches the cookie-cutter answer they've already memorized.
People like this are the bane of Stack Overflow. They don't understand the more technically arcane questions, and shit their whys and don'ts instead of simply keeping their ignorant mouths shut.
No comments:
Post a Comment