I need to check the exit status of a piped command from R on Debian, like here, but cannot make run echo "${pipestatus[1]}"
successfully from R using system2
/system
function. The command works properly when I use command line.
The command I am trying to use in R can look like this (the shell I use is zsh):
system2("false", args = "|true;echo '${pipestatus[1]}'")
After some testing I can see that the exit status checking command cannot be quoted properly but I cannot figure out the correct way to do so.
Am I right that quoting this command properly is the issue? How to run this (echo "${pipestatus[1]}"
) command from R? Are there any alternatives to using the command in question to check exit status?