Various bash stuff

Just looked this over and changed things towards the way I might do it.