Rewrite chef.sh to be more cross-platform.

Rewrite chef.sh to be more cross-platform.

Thanks to @lamont-granquist and everyone else for the Bourne shell code I ripped off.