Replace '$MACHTYPE' with '$system_os' to enhance grepping os type.

$MACHTYPE only returns bits information and should not be used to grep os type (e.g. darwin, linux, etc.)

To fix this, I parsed os type from uname command.