Last active
February 8, 2018 15:14
-
-
Save 59023g/cb632616a7c39fcd0f9e11190617efbe to your computer and use it in GitHub Desktop.
bash: loop through package array, if not exist, install package ( non-interactive )
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
!#/bin/bash | |
apt-get update | |
packages=( "curl" "python2.7" "git", "make", "openjdk-8-jre" ) | |
for i in "${packages[@]}" | |
do | |
if ! [ -x "$(command -v $i)" ]; then | |
echo "--- installing $i ---" > &1 | |
apt-get -y install $i | |
else | |
echo "--- $i already installed --- " | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment