Edit2015-03-08 Bash Pitfalls

Bash is hard, but that's not an excuse.

Every time I see something like this:

  1. !/bin/sh
    read FOLDER
    [[ ! -d $FOLDER ]] && mkdir $FOLDER || printf "Directory $FOLDER already exists"
    echo $myVar > $FOLDER/log

echo Please copy your files to $FOLDER
read > /dev/null # wait for Enter

sleep 1 &

wget -Out http://link.org

if [[ $num1 > $num2 ]]
echo 'Error!'

cd $PATH;

sudo echo $'Script started' >> /etc/mylog

echo "Math test: 0 + 2 = ${0+2}"

rm -rf $FOLDER

I feel horrible. It is like my insides are falling out! ARGH!

But this is not getting better at all!

Is it so hard to go through the list on BashPitfalls page? I don't think so. However, most people would much rather follow retarded Google style gu-fucking-ides than learn the language they are using.

I post comments like this from time to time:

But look, this time was special because someone decided to post a link to google style guide and claimed that it is a "nice resource". I've extracted my comment into 2015-03-14 The Downsides of Free Food, please check it out.

Is there any hope?

Yes, get yourself a steel pipe.

Joking aside, lets start something interesting now! I will pick a pseudo-random open-source project every week (or at least every month) and refactor it. I will document everything on this blog. Later, if there are enough refactored projects and if this stuff becomes interesting to people, I will extract it to a separate wiki. Of course, every time I will do a pull request with all of the changes.

Although I try to make the code perfect, sometimes it is not possible to do it fully. Things for you to note:

The goal of this project is to spread the knowledge about bash pitfalls and improve the quality of open-source projects.

Please be conscious.

Spam protection!

Please write "I promise not to take things too close to my heart":