Last active
February 6, 2018 16:43
-
-
Save edouard-lopez/10008944 to your computer and use it in GitHub Desktop.
Using bash array and parameter expansion to have multiline command.
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
sudo apt-get install -y git python python-dev \ | |
python-setuptools libxml2-dev libxslt-dev zlib1g-dev \ | |
postgresql postgresql-client python-psycopg2 |
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
# array are more flexible to formatting | |
pkg_list=( | |
git python python-dev | |
python-setuptools libxml2-dev libxslt-dev zlib1g-dev | |
postgresql postgresql-client python-psycopg2 | |
) | |
# the final command is short and has better readibility | |
sudo apt-get install -y "${pkg_list[@]}" | |
# Option such as '-y' or '--yes' can also be moved to the $pkg_list array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment