Search code examples
rbashrscript

/usr/bin/Rscript: Argument list too long


Using rscript inside a bash script

I am passing the content of text files has arguments. to rscript

"$SCRIPTS/myscript.R" "$filecontent"

I get the following when file have +- over 4000 row

/usr/bin/Rscript: Argument list too long

Any way I can increase the length of accepted argument so I can pass large files?


Solution

  • What @MrFlick said is correct - you should change the way the arguments are passed to your script. However, if you still want to try to do it your way, then I recommend reading the following article:

    "Argument list too long": Beyond Arguments and Limitations

    The "Argument list too long" error, which occurs anytime a user feeds too many arguments to a single command, leaves the user to fend for oneself, since all regular system commands (ls *, cp *, rm *, etc...) are subject to the same limitation. This article will focus on identifying four different workaround solutions to this problem, each method using varying degrees of complexity to solve different potential problems.

    Also, this Unix&Linux thread can help:

    “Argument list too long”: How do I deal with it, without changing my command?