Fixed bash-script to work on CentOS6 and OS X

Fixed some syntax to make it work on bash v4 (i.e. CentOS 6)