The general
##The general ReasonsReasons a post could be downvoted include, but are not limited to:
- Somebody hates you.
- The user who downvoted always downvotes on the first Thursday of every month.
- Someone misunderstood your answer.
- Someone dislikes your avatar.
- Someone hates bash, why are you using bash?
- Someone is having a bad day
- Your answer has errors.
- You left a comment complaining about downvotes, that's a good way to get more downvotes.
Basically, downvotes can happen for any reason. Yes, they often indicate there's something wrong with your answer (more on that later) but they just as often are random events and complaining about them is pointless. Just shrug it off and move on.
Leaving comments like "Why was this downvoted" is doubly useless since the person who downvoted is not going to be notified, therefore the comment just adds noise to the site and makes you sound like a whiner. On the site I moderate, I always delete such comments.
The specific
In this particular case, your script has a few issues. Though I, personally, wouldn't have downvoted, I didn't upvote either. Some things you can improve:
- There is no need for
touch file
. Printing to a file will create it if it doesn't exist. - You are checking for the alias's existence only in the (as far as I know, Ubuntu-only)
~/.bash_aliases
. What if the alias was defined in~/.bashrc
or~/.bash_login
or~/.profile
or even/etc/bash.bashrc
or any of the other init files? - You have put all the comments on the far right of the line. This means that I can't read both the line and the comment describes it and makes me scroll. I don't like scrolling. Maybe someone dislikes it so much, they downvoted you.