

- #Install gnu bash on mac os mac os x
- #Install gnu bash on mac os install
- #Install gnu bash on mac os portable

#Install gnu bash on mac os mac os x
On a few different machines: Mac OS X Leopard:Ĥ.4BSD/Mach3.0 (iX86) Apple Darwin 9.6.0 (i386) Apple Mac OS X 10.5.6 (iX86) Here is the output of: shtool platform -v -F "%sc (%ac) %st (%at) %sp (%ap)"
#Install gnu bash on mac os portable
GNU shtool is a very portable set of scripts that contains, among other useful things, the 'shtool platform' command. I wrote a personal Bash library and scripting framework that uses GNU shtool to do a rather accurate platform detection. I recommend to use this complete bash code lowercase()" If you want to cut corners, uname -m and plain uname will tell you what you want to know on many platforms. So for example, a shell script to reformat mail can call, e.g., $LIB/mailfmt which is a platform-specific executable binary. Then I set a boatload of environment variables. I have platform-specific bin, man, lib, and include directories that get set up based on that. My ~/.profile runs an a script at startup which sets one variable to a string indicating the combination of CPU and operating system.

For example, just to keep things simple, I treat i386 through i686, any " Pentium*" and any " AMD*Athlon*" all as x86. Uname with no arguments will name the operating system.Įventually you will have to think about the distinctions between platforms and how fine you want to make them. bin/arch, if it exists, will usually give the type of processor. Uname -m will give the "machine hardware name" on some Unix systems. Uname -p is processor type but is usually unknown on modern Unix platforms. I have a sh script of about 100 lines that works across a very wide variety of Unix platforms: any system I have used since 1988. Installing packages python2.7 python-dev python-pip libssl-dev on Ubuntuĭetecting operating system and CPU type is not so easy to do portably. Output example for Ubuntu Linux: sudo sh detect_os.sh
#Install gnu bash on mac os install
If cat /etc/*release | grep ^NAME | grep CentOS thenĮcho "="Įcho "Installing packages $YUM_PACKAGE_NAME on CentOS"Įlif cat /etc/*release | grep ^NAME | grep Red thenĮcho "Installing packages $YUM_PACKAGE_NAME on RedHat"Įlif cat /etc/*release | grep ^NAME | grep Fedora thenĮcho "Installing packages $YUM_PACKAGE_NAME on Fedorea"Įlif cat /etc/*release | grep ^NAME | grep Ubuntu thenĮcho "Installing packages $DEB_PACKAGE_NAME on Ubuntu"Įlif cat /etc/*release | grep ^NAME | grep Debian thenĮcho "Installing packages $DEB_PACKAGE_NAME on Debian"Įlif cat /etc/*release | grep ^NAME | grep Mint thenĮcho "Installing packages $DEB_PACKAGE_NAME on Mint"Įlif cat /etc/*release | grep ^NAME | grep Knoppix thenĮcho "Installing packages $DEB_PACKAGE_NAME on Kanoppix"Įcho "OS NOT DETECTED, couldn't install package $PACKAGE"

YUM_PACKAGE_NAME="python python-devl python-pip openssl-devel"ĭEB_PACKAGE_NAME="python2.7 python-dev python-pip libssl-dev" Below it's an approach to detect Debian and RedHat based Linux OS making use of the /etc/lsb-release and /etc/os-release (depending on the Linux flavor you're using) and take a simple action based on it.
