diff --git a/rstudio_version_check.sh b/rstudio_version_check.sh
index 75d333bd40fd3d1e963ac2cd557b680840a36ac5..85b56f0f61ec93cb682d1f3ac9fc5ee2ab7494ec 100755
--- a/rstudio_version_check.sh
+++ b/rstudio_version_check.sh
@@ -2,23 +2,23 @@
 # check for new rstudio and download it if necessary
 
 set -e
-
-rawstring=$(curl -s https://www.rstudio.com/products/rstudio/download-server/ |grep -o "wget.*amd64.deb")
+ubuntudlversion=trusty
+rawstring=$(curl -s https://rstudio.com/products/rstudio/download-server/debian-ubuntu/ |
+  grep -o -e "wget https:\/\/.*server\/${ubuntudlversion}.*\/rstudio-server-[0-9.]\+-amd64.deb")
 prefix="$"
 suffix="<br />"
 noprefix=${rawstring#$prefix}
 nosuffix=${noprefix%$suffix}
-dlcommand="$(echo $nosuffix -q -P /home/monitoring/)"
+dlcommand="$nosuffix -q -P /home/monitoring/"
 cur_version=$(rstudio-server version)
-avail_version="$(echo $dlcommand | cut -d "-" -f 3)"
+avail_version=$(cut -d "-" -f 3 <<< "$dlcommand")
 if [ "$avail_version" == "$cur_version" ]
   then
     echo "RStudio up to date."
   else
-    if [ ! -e /home/monitoring/rstudio-server-${avail_version}-amd64.deb ]
+    if [ ! -e /home/monitoring/rstudio-server-"${avail_version}"-amd64.deb ]
       then
-        eval $dlcommand
+        eval "$dlcommand"
     fi
     echo "RStudio version $avail_version available (in use $cur_version)"
 fi
-