Fixed shell script for MAC, needs testing on linux now.