Ubuntu – When trying to Install Shiny Server for R, the command in the setup instructions triggers a Bash syntax error, how to fix it

bashr

So I'm trying to install shiny server for the R programming language on Ubuntu 12.04, using the information available at this page on the program's github.

However, when I get to this step:

# Install Shiny in system-wide library
sudo su - -c "R -e \\"install.packages('shiny', repos='http://cran.rstudio.com/')\\""

I get the following:

bash: syntax error near unexpected token `('

Best Answer

The two " characters are cancelling each other out at the beginning, I believe, because the quotes are incorrectly escaped. I'm not certain why they have \\" (which is interpreted as an escaped \ character with an unescaped " after that, and not an escaped " character) instead of \" which is the proper way to escape the quote, but that likely is the cause of this problem.

Try using this instead, it may work:

sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""

I have done some looking into this. The instructions that were initially provided for this in the GitHub repository for the software have been marked as "Obsolete".

This is the installation instructions that they now refer to. If you are running into this issue, you should not be using the documentation on the GitHub repository, and should be using the new instructions instead.

Related Question