use of "input" in system()
On Fri, 24 Apr 2009, Mike Miller wrote:
I am running bash, but system calls go to sh. I want to be able to put
that input string ("0005") into a variable and do something like this:
system( "i=`cat /dev/stdin` ; run_script > file${i}.out" , input=sprintf("%04d", i) )
In sh, both of these commands execute ls: echo ls | `cat /dev/stdin` echo ls | `cat -` In R, both of these simply hang until I hit ctrl-c...
system( "`cat /dev/stdin`", input="ls" ) system( "`cat -`", input="ls" )
...but the stdin is getting to the command because both of these return "ls" to stdout:
system( "cat -", input="ls" ) system( "cat /dev/stdin", input="ls" )
So what am I missing? I don't understand why the backtick method isn't working. Is there another way to do this? Mike