Created
May 17, 2018 12:03
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################### | |
# 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