Fixed bash-script to work on CentOS6 and OS X