Skip to content

Instantly share code, notes, and snippets.

@edouard-lopez
Last active February 6, 2018 16:43
Show Gist options
  • Save edouard-lopez/10008944 to your computer and use it in GitHub Desktop.
Save edouard-lopez/10008944 to your computer and use it in GitHub Desktop.
Using bash array and parameter expansion to have multiline command.
sudo apt-get install -y git python python-dev \
python-setuptools libxml2-dev libxslt-dev zlib1g-dev \
postgresql postgresql-client python-psycopg2
# 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