Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy my bash can't execute R script?
    text
    copied!<p>My script use an access to mysql to get command arguments to launch Rscript. Its use is as follows : Rscript $RFILE $ARGUMENTS (RFILE corresponding to path to Rscript, and ARGUMENTS corresponding to path file used and agr).</p> <p>I try, different way, but I still have errors, here a copy of my bash script :</p> <pre><code>#!/usr/bin/env bash # Execute R process # ----------------- ### Mysql Setup ### USER=... PASS=... HOST=... DB=... # Get Job ID process # Use to retrieve args in my DB ID=$1 # Get script name RFILE=$(mysql -u$USER -p$PASS -e "SELECT script_name FROM JobProcess WHERE script_run_id=$ID;" $DB) SUBSTRING="script_name" RFILE="${RFILE//$SUBSTRING}" # Get script_args ARGUMENTS=$(mysql -u$USER -p$PASS -e "SELECT script_args FROM JobProcess WHERE script_run_id=$ID;" $DB) SUBSTRING2="script_args" ARGUMENTS="${ARGUMENTS//$SUBSTRING2}" RUN="Rscript $RFILE $ARGUMENTS" # Try Different execute process Rscript $RFILE $ARGUMENTS #eval "$RUN" #`Rscript $RFILE $ARGUMENTS` #$RUN </code></pre> <p>I verified my command line (via echo), and if I made a copy-paste to my shell I can run my R script. But from my bash, I can't execute my script (but command line is good).</p> <p>By using : Rscript $RFILE $ARGUMENTS, <code>Rscript $RFILE $ARGUMENTS</code> and $RUN, I have this error : </p> <pre><code>Error in parse(text = args[[i]]) : unexpected end of input in ""path_in='/Users/GR/web-app/Rproject/Inputs/Rscript/Gene-level" Calls: eval -&gt; parse Execution halted </code></pre> <p>By using : eval "$RUN", I have this error :</p> <pre><code>/Users/GR/web-app/Rproject/Scripts/Rscript.sh: line 38: /Users/GR/web-app/Rproject/Scripts/arg_file_test.R: Permission denied /Users/GR/web-app/Rproject/Scripts/Rscript.sh: line 44: path_in&lt;-"/Users/GR/web-app/Rproject/Inputs/Rscript/Gene-level Description for Modules.csv": No such file or directory </code></pre> <p>If I try this in my shell script, all works fine :</p> <pre><code>SCRIPT="/Users/GR/web-app/Rproject/Scripts/arg_file_test.R" FILE1="path_in='/Users/GR/web-app/Rproject/Inputs/Rscript/Gene-level Description for Modules.csv'" FILE2="path_in2='/Users/GR/web-app/Rproject/Inputs/Rscript/Template_Auto.csv'" FILES="\"$FILE1\" \"$FILE2\"" ARG="l=32 w=33" RUN="Rscript $SCRIPT $FILES $ARG" </code></pre> <p>Someone has an idea ?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload