fix script for *BSD like operating systems