I run this command on ubuntu:
su - test -c cp /home/test/toto.txt /home/test/dir
But I have this error!
cp: missing file operand
anyone has an idea about the problem? thank you
Option -c
is understood by command su
, taking the next argument (not the remaining) to be the command. That next command is just cp
.
Try putting the command into quotes:
su - test -c 'cp /home/test/toto.txt /home/test/dir'
If this is problematic because you want to have quotes inside the command, try using escape instead of the inner quotes:
su - test -c 'echo hello\ \ there'