command line - How do I write a shell script to install a list of applications? - Ask Ubuntu

PHOTO EMBED

Wed Mar 16 2022 12:56:00 GMT+0000 (UTC)

Saved by @Bami ##terminal #linux #commandline

#!/bin/bash

set -eu -o pipefail # fail on error and report it, debug all lines

sudo -n true
test $? -eq 0 || exit 1 "you should have sudo privilege to run this script"

echo installing the must-have pre-requisites
while read -r p ; do sudo apt-get install -y $p ; done < <(cat << "EOF"
    perl
    zip unzip
    exuberant-ctags
    mutt
    libxml-atom-perl
    postgresql-9.6
    libdbd-pgsql
    curl
    wget
    libwww-curl-perl
EOF
)

echo installing the nice-to-have pre-requisites
echo you have 5 seconds to proceed ...
echo or
echo hit Ctrl+C to quit
echo -e "\n"
sleep 6

sudo apt-get install -y tig
content_copyCOPY

This is my first starred post which feels useful on Linux.

https://askubuntu.com/questions/519/how-do-i-write-a-shell-script-to-install-a-list-of-applications