Eu descobri no passado que amarrar os comandos juntos dessa maneira causa problemas se um deles tiver um "soluço".
Por exemplo, se o seu comando é semelhante a este:
sudo apt-get install 1 2 3 4
então, se houver um erro no programa 3, 4 não será instalado. Mantê-los separados em cada linha corrige esse problema. se houver um erro, o script continua.
Veja um exemplo de script que uso para novas instalações:
echo " "
echo "Please run this in an empty folder. Failure to do so may cause data loss!"
read -p "Press ENTER to continue, or close the window to abort."
echo " "
echo "Now backing up the sources list."
read -p "Press ENTER to continue..."
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo " "
echo "Now adding all the new repositories and keys."
read -p "Press ENTER to continue..."
sudo add-apt-repository -y "ppa:maarten-baert/simplescreenrecorder"
sudo add-apt-repository -y "deb http://download.videolan.org/pub/debian/stable/ /"
sudo add-apt-repository -y "ppa:stebbins/handbrake-releases"
sudo add-apt-repository -y "ppa:tsbarnes/indicator-keylock"
sudo add-apt-repository -y "ppa:freefilesync/ffs"
sudo add-apt-repository -y "deb http://apt.insynchq.com/ubuntu trusty non-free contrib"
sudo apt-add-repository -y "ppa:rael-gc/scudcloud"
wget -qO - https://d2t3ff60b2tol4.cloudfront.net/[email protected] \ | sudo apt-key add -
wget -O - http://download.videolan.org/pub/debian/videolan-apt.asc | sudo apt-key add -
echo " "
echo "Now removing all the programs I never use"
read -p "Press ENTER to continue..."
sudo apt-get autoremove -y abiword
sudo apt-get autoremove -y gnumeric
sudo apt-get autoremove -y firefox
sudo apt-get autoremove -y gmusicbrowser
sudo apt-get autoremove -y parole
sudo apt-get update
echo " "
echo "Now installing everything I use."
read -p "Press ENTER to continue..."
sudo apt-get install -y gdebi
sudo apt-get install -y screen
sudo apt-get install -y openvpn
sudo apt-get install -y openjdk-7-jre
sudo apt-get install -y guake
sudo apt-get install -y libreoffice
sudo apt-get install -y audacity
sudo apt-get install -y synaptic
sudo apt-get install -y moc
sudo apt-get install -y p7zip-full
sudo apt-get install -y mtools
sudo apt-get install -y mono-runtime
sudo apt-get install -y wine
sudo apt-get install -y aisleriot
sudo apt-get install -y gparted
sudo apt-get install -y tango-icon-theme
sudo apt-get install -y tango-icon-theme-extras
sudo apt-get install -y thunderbird
sudo apt-get install -y htop
sudo apt-get install -y xscreensaver
sudo apt-get install -y python-pygame
sudo apt-get install -y gimp
sudo apt-get install -y xterm
sudo apt-get install -y indicator-keylock
sudo apt-get install -y libdvdcss2
sudo apt-get install -y vlc
sudo apt-get install -y handbrake-gtk
sudo apt-get install -y openshot
sudo apt-get install -y openshot-doc
sudo apt-get install -y simplescreenrecorder
sudo apt-get install -y freefilesync
sudo apt-get install -y mono-devel
sudo apt-get install -y pinta
sudo apt-get install -y insync
sudo apt-get install -y scudcloud
sudo apt-get install -y hunspell-en-ussudo
sudo apt-get install -y xscreensaver-screensaver-webcollage
sudo apt-get install -y xscreensaver-screensaver-bsod
sudo apt-get install -y xscreensaver-screensaver-dizzy
sudo apt-get install -y xscreensaver-gl
sudo apt-get install -y xscreensaver-gl-extra
echo " "
echo "Downloading .deb files."
read -p "Press ENTER to continue..."
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
wget http://download.teamviewer.com/download/teamviewer_i386.deb
echo " "
echo "Now installing the .deb files we downloaded earlier."
read -p "Press ENTER to continue..."
sudo gdebi google-chrome-stable_current_amd64.deb
sudo gdebi teamviewer_i386.deb
echo " "
echo "Now configuring mono."
read -p "Press ENTER to continue..."
mozroots --import --ask-remove
echo " "
echo "Now cleaning up the mess we made."
read -p "Press ENTER to continue..."
echo " "
sudo apt-get autoremove -y && sudo apt-get clean
echo " "
echo "Now we'll download kernel 4.0. ABORT if you are uncertain that you want this!"
read -p "Press ENTER to continue..."
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-rc1-vivid/linux-headers-4.0.0-040000rc1_4.0.0-040000rc1.201502222235_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-rc1-vivid/linux-headers-4.0.0-040000rc1-generic_4.0.0-040000rc1.201502222235_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-rc1-vivid/linux-image-4.0.0-040000rc1-generic_4.0.0-040000rc1.201502222235_amd64.deb
echo " "
echo "Now installing kernel 4.0. LAST CHANCE TO ABORT!"
read -p "Press ENTER to continue..."
sudo dpkg -i linux-headers-4.0*.deb linux-image-4.0*.deb
echo " "
echo "Now cleaning up our mess again."
read -p "Press ENTER to continue..."
rm *.deb
sudo reboot