Skip to content

Instantly share code, notes, and snippets.

@thejeff77
Created March 12, 2019 15:17
Show Gist options
  • Save thejeff77/43259fd5f0f30a26c86b9562ef865b61 to your computer and use it in GitHub Desktop.
Save thejeff77/43259fd5f0f30a26c86b9562ef865b61 to your computer and use it in GitHub Desktop.
Bash script example - Detect Linux Flavor and run conditional code
#!/bin/bash
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
if [${unameOut} -eq “Darwin” ]; then
brew install wget | true
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment