change bash prompt if SSH shell. Also tidy up code.