Making shebang paths more flexible for different platforms

The changes makes it more flexible for other platforms like FreeBSD and OpenBSD