Code Yarns β€πŸ‘¨β€πŸ’»
Tech Blog ❖ Personal Blog

How to check for Cygwin in Bash scripts

πŸ“… 2013-Jul-26 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ bash, cygwin ⬩ πŸ“š Archive

To check for CygwinΒ in bashrc or bash scripts, use this:

if [[ "$OSTYPE" == "cygwin" ]]; then
    # Do something
fi

Tried with: Bash 4.1.10 and Cygwin 1.7.22


Β© 2022 Ashwin Nanjappa β€’ All writing under CC BY-SA license β€’ 🐘 @codeyarns@hachyderm.io β€’ πŸ“§