A clever bash script for R Users

Back in 2017 I wrote a blog post describing a simple bash script for installing R in a Ubuntu setup. The problem with this script, and many others found in the internet, is that they quickly become obsolete due to changes in Ubuntu, R and RStudio. For example, if Ubuntu version changes from “trusty” to “focal”, the link to the CRAN ppa also changes. The same is true with RStudio, which does not provide installation by apt, only downloadable .deb files from its website. Today I manage to develop a clever bash script that uses the internet and local files to find out the current version of all software.