Created
September 11, 2019 22:54
-
-
Save SofianeHamlaoui/dd0439429b76bd9e59e6d428a6c6b275 to your computer and use it in GitHub Desktop.
Check what linux package manager is used [BASH]
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
function apt { | |
which apt > /dev/null 2>&1 | |
if [ "$?" -eq "0" ]; then | |
apt install THEPACKAGES | |
} | |
function pacman { | |
which pacman > /dev/null 2>&1 | |
if [ "$?" -eq "0" ]; then | |
pacman -S THEPACKAGES | |
} | |
function zypper { | |
which zypper > /dev/null 2>&1 | |
if [ "$?" -eq "0" ]; then | |
zypper install THEPACKAGES | |
function dnf { | |
which dnf > /dev/null 2>&1 | |
if [ "$?" -eq "0" ]; then | |
dnf install THEPACKAGES | |
} | |
function yum { | |
which yum > /dev/null 2>&1 | |
if [ "$?" -eq "0" ]; then | |
yum install THEPACKAGES | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment