Launch multiple RStudio projects from the command line

I want to create an alias in my .bashrc file, so that I can easily launch a few current projects at once.

My attempts look like:

rstudio ~/projects/proj1/proj1.Rproj & \          
  rstudio ~/projects/proj2/proj2.Rproj & 

which does something surprising to me: it launches proj1 twice, and both RStudio instances seem to share the same R session, with their consoles synced.

My questions are:

  • any idea what is happening?
  • how can I achieve my goal (launch multiple projects at once)?

The simplest solution would be to sleep or wait after launching each RStudio session -- it seems like there's a race condition where multiple versions of RStudio launches at the same time can bind to the same session.

Thanks Kevin, that worked!

rstudio ~/projects/proj1/proj1.Rproj & \
  sleep 1 && \
  rstudio ~/projects/proj2/proj2.Rproj & 

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.