#/bin/bash

# firstScreen.sh

user=`whoami`

if [ "$user" == "root" ] || [ "$user" == "ubuntu" ]; then
  # As suggested by glenn jackman. Since I don't have anything to run once 
  # switching the user, I can modify the next line to: 
  # exec sudo -u raamee my_script and reuse the same process
  echo "hi there I am $user, nice to see you"
  # su rstudio -c 'cd ~/git; R'
  sudo su -c 'cd ~/git; R' -s /bin/bash rstudio 
fi

if [ "$user" == "rstudio" ]; then
  cd '~/git'
  R
fi