티스토리 뷰

공부

[Sh] check detect OS

승가비 2020. 4. 18. 18:00
728x90
if [[ "$OSTYPE" == "linux-gnu" ]]; then
        # ...
elif [[ "$OSTYPE" == "darwin"* ]]; then
        # Mac OSX
elif [[ "$OSTYPE" == "cygwin" ]]; then
        # POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
        # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
        # I'm not sure this can happen.
elif [[ "$OSTYPE" == "freebsd"* ]]; then
        # ...
else
        # Unknown.
fi

https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script

 

How to detect the OS from a Bash script?

I would like to keep my .bashrc and .bash_login files in version control so that I can use them between all the computers I use. The problem is I have some OS specific aliases so I was looking for ...

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[Spring] dependency  (0) 2020.04.21
[Sh] date  (0) 2020.04.18
[Sh] do ~ while  (0) 2020.04.18
[oozie] data in coordinator  (0) 2020.04.18
[Presto] int to hex  (0) 2020.04.17
댓글