dylanaraps/pure-bash-bible

Do not recommend "$OSTYPE" instead of "uname"

ahmetb opened this issue · 2 comments

  1. $OSTYPE is inconsistent between the shells and uname:

    image

  2. $OSTYPE contains a version suffix (see above) which requires a regexp to be stripped, whereas uname returns a plain string like Darwin or Linux.

I think that's the point of pure bash though -- to avoid using uname :)

In the example provided, you can see how it's used with lossy matching, which should fit most use cases: https://github.com/dylanaraps/pure-bash-bible/blob/master/README.md#simpler-case-statement-to-set-variable

IMHO this is BASH bible, so how other shells treat those things should not be a concern here.
Uname is binary, so it's not a BASH thing - therefore no place for that in "PURE BASH".