how to use multiple arguments for mutliple R script?

i’m new to bioinformatic and i try to use multiple R script in a bash script but here is the problem : all R script use multiple arguments, and i don’t want the user to write like 16 long arguments, for the moment i use positionnal argument like this :

#!/bin/bash

Rscript \pathway\script1.R $1 $2 $3 $4

Rscript \pathway\script2.R $5 $6 $7 $8

Rscript \pathway\script1.R $1 $2 $3 $4

Rscript \pathway\script2.R $5 $6 $7 $8

Rscript \pathway\ script3.R $9 $10 $11 $12

Rscript \pathway\ script4.R $13 $14 $15 $16

All argument are mostly pathway, and i hope to get something the user don’t have to write down 12 long arguments (something more friendly), is there a way to do it ? (like using a file the user have to fill for arguments ?) i tried

Thanks in advance for your answer !

  • Are these really 16 unique values? If they are all separate value and are all required for running the script, I’m not sure there’s a way to make the input any easier. You mention using a file. Do you want them to write the 16 values on separate lines of the file? If so, maybe these ideas could help: stackoverflow.com/questions/64559500/…

    – 

  • Thanks for your answer, for the moment i don’t use a separate file, i use one bash script for one R script to only use 4 argument, but since i want to use all R script in one go i try to find an other way than write 16 arguments each type i wanna use it, or maybe find a simple way to do it

    – 

  • do you really run script1.R $1 $2 $3 $4 (same for script2.R) twice?

    – 

  • i run them separatly when i need them, but now i wanted to run them all and optimise arguments

    – 

Leave a Comment