我需要将在 Linux (Ubuntu) 上运行的 Firefox 进程的数量存储在 R 脚本的变量中。我使用的 system2 命令本身似乎有效。但是,当我添加stdout = TRUE
以捕获字符向量中的信息时,我会收到警告。为什么要发出警告?
system2(command = "ps", args = "aux | grep [f]irefox -c")
# 0
system2(command = "ps", args = "aux | grep [f]irefox -c", stdout = TRUE)
Warning message:
In system2(command = "ps", args = "aux | grep [f]irefox -c", stdout = TRUE) :
running command ''ps' aux | grep [f]irefox -c' had status 1