【发布时间】:2013-08-01 11:28:07
【问题描述】:
我在 ubuntu 上运行这个命令:
su - test -c cp /home/test/toto.txt /home/test/dir
但是我有这个错误!
cp: missing file operand
有人知道这个问题吗? 谢谢
【问题讨论】:
-
如果我说,“用 sudo 代替 su”,那也没用吧?
我在 ubuntu 上运行这个命令:
su - test -c cp /home/test/toto.txt /home/test/dir
但是我有这个错误!
cp: missing file operand
有人知道这个问题吗? 谢谢
【问题讨论】:
选项-c 被命令su 理解,将下一个 参数(不是剩余的)作为命令。下一个命令就是cp。
尝试将命令放在引号中:
su - test -c 'cp /home/test/toto.txt /home/test/dir'
如果这是因为您想在命令中包含引号而导致问题,请尝试使用转义 而不是 内部引号:
su - test -c 'echo hello\ \ there'
【讨论】: