#!/bin/bash # exit when any command fails set -e # keep track of the last executed command trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG # echo an error message before exiting trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT rstudio-server offline [ ! -d "/tmp/install" ] && mkdir /tmp/install cd /tmp/install wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.4.1106-amd64.deb gdebi rstudio-server-1.4.1106-amd64.deb rstudio-server online