Every piece of code is bad in the eyes of a pedantic coder.Daily I see examples of bad code and commands and I was wondering where on this forum it would be a good place to post this kind of examples, explaining why they are a bad idea.
I have to agree.Every piece of code is bad in the eyes of a pedantic coder.
I consider myself pedantic, when ever I clone something from GitHub the very first thing I do is fixing bad formatting, syntax errors, build errors or what ever other stuff that I don't like.
The code might be functional and quality made, but very rarely I find it readable or pleasant for my eye or coding styles.
It's just something you have to accept.
Either you continue writing bad code or otherwise reinvent the wheel and do it all from scratch to be happy.
cd /some/path ; rm -rf *
Willing to read it and contribute is part of my summer project.@Alexzee
Linus Torvalds once said that bad coders care about the code while good coders care about data structures.
And I disagree with him, no wonder Linux kernel is so hard to understand and to read with his programming logic.
He writes quality code, but where are the people willing to read it and contribute?
Got it-The "code" I refer to is more related to command line usage, not entire source code of the Linux Kernel
Things like this:
cd /some/path ; rm -rf *
cat /path/to/file | grep whatever
grep whatever /path/to/file
Using cat and grep together is probably one of the most common things I see:
E.g.
Bash:cat /path/to/file | grep whatever
There’s no need for cat. Just use grep:
Bash:grep whatever /path/to/file
cd /some/directory ; unzip /source/file.zip -d .
cd /source ; unzip file.zip -d /some/directory
cd /some/directory ; unzip /source/file.zip
Using cat and grep together is probably one of the most common things I see:
E.g.
Bash:cat /path/to/file | grep whatever
There’s no need for cat. Just use grep:
Bash:grep whatever /path/to/file
cat -v word file.txt | grep whatever
/usr/bin/cp sourcefile.txt targetfile.txt