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 alias mvim="/Applications/MacVim.app/Contents/MacOS/MacVim"
.
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.
uname -s
show on a Mac? Under Linux, it returnsLinux
. – John1024 Jul 05 '16 at 00:03Darwin
, so, that helps quite a bit, along with Julie's suggestion. ty – Chuck Jul 05 '16 at 00:16uname
seems to be perfect for that. – Chuck Jul 05 '16 at 05:04