9/19/2023 0 Comments Linux mac os x comparison table![]() ![]() Mac OS X 10.6.8 (Snow Leopard) do not have expr program unless you install it, so I just use uname.In your bash script, use #!/usr/bin/env bash instead of #!/bin/sh to prevent the problem caused by /bin/sh linked to different default shell in different platforms, or there will be error like unexpected operator, that's what happened on my computer (Ubuntu 64 bits 12.04).If you are doing that, it's your responsibility to ensure the correct executables (i.e., the CygWin ones) are being called, possibly by modifying the path beforehand or fully specifying the executable locations (e.g., /c/cygwin/bin/uname).ĭetect three different OS types (GNU/Linux, Mac OS X, Windows NT) Notes As one commenter notes, you can run the bash program, passing the script, from cmd itself and this may result in the paths not being set up as needed. Note that I'm assuming here that you're actually running within CygWin (the bash shell of it) so paths should already be correctly set up. So the bash code to do such a check would be along the lines of: unameOut="$(uname -s)" But you may have to experiment with all sorts of different versions. Usually, uname with its various options will tell you what environment you're running in: pax> uname -aĬYGWIN_NT-5.1 IBM-元F3936 1.5.25(0.156/4/2) 19:34 i686 CygwinĪnd, according to the very helpful schot (in the comments), uname -s gives Darwin for OSX and Linux for Linux, while my Cygwin gives CYGWIN_NT-5.1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |