Skip to content

Instantly share code, notes, and snippets.

@ridingintraffic
Last active December 23, 2018 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridingintraffic/7c60ec7158253fe16c3ccc6c1c1896cc to your computer and use it in GitHub Desktop.
Save ridingintraffic/7c60ec7158253fe16c3ccc6c1c1896cc to your computer and use it in GitHub Desktop.
system detection
# loading the system speicfic profiles
if [ "Linux" = "$(uname -a | awk '{printf $1}')" ]; then
if [ "raspbian" = "$(cat /etc/os-release | grep ^ID= |sed 's/ID=//')" ]; then
echo "raspbian"
source "$HOME/.rpi_profile"
elif [ "ubuntu" = "$(cat /etc/os-release | grep ^ID= |sed 's/ID=//')" ]; then
echo "ubuntu"
source "$HOME/.ubu_profile"
elif [ "centos" = "$(cat /etc/os-release | grep ^ID= |sed 's/ID=//')" ]; then
echo "centos"
source "$HOME/.centos_profile"
elif [ "kali" = "$(cat /etc/os-release | grep ^ID= |sed 's/ID=//')" ]; then
echo "kali"
source "$HOME/.kali_profile"
else
echo "unknown"
fi
fi
if [ "Mac" = "$(sw_vers|grep ProductName |awk '{printf $2}')" ]; then
if [ "home_computer" = "$(hostname)" ]; then
source "$HOME/.home_profile"
fi
if [ "work_computer" = "$(hostname)" ]; then
source "$HOME/.work_profile"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment