Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
Created May 17, 2018 12:03
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 infamousjoeg/cd5cea1e27235dfd3ee054cab8331600 to your computer and use it in GitHub Desktop.
Save infamousjoeg/cd5cea1e27235dfd3ee054cab8331600 to your computer and use it in GitHub Desktop.
Function created to detect yum or apt-get package manager and report back
#######################################
# Detects yum or apt-get
# Globals:
# None
# Arguments:
# None
# Returns:
# Package Manager command
#######################################
packagemanager() {
declare -A OS_INFO;
OS_INFO[/etc/redhat-release]=yum
OS_INFO[/etc/debian_version]=apt-get
for OS in ${!OS_INFO[@]}
do
if [[ -f $OS ]]; then
printf ${OS_INFO[$OS]}
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment