This question already has an answer here:
On my main machine, a MacBook Pro, I have a
.bash_profile file that I'd like to use unaltered on my Dreamhost linux machine. However, there's a few lines that are only applicable to macOS, such as
Is there a way in bash to test for whether it's running under macOS or Debian (or just not macOS) and only execute that above line, and a few others, when running under macOS? Whereas other questions here address how to find out which Linux distro is being used, here I only need to know if I'm running on macOS or Linux, and the solutions for knowing the Linux distro aren't available on macOS.