a bit of restructuring, fixed Linux check to cover OSX/Darwin and other unix shell OSs