7

I am trying to run this bash command, but I cant get around the "|" pipe character

rsh -l user machine "echo "PORTS = 123|456|789" >> conf.cfg"

Getting:

bash: 456 >> conf.cfg: No such file or directory

bash: 789: command not found

Would you know how I can echo PORTS = 123|456|789 into a remote file ?

Thanks!

4

1 回答 1

10

Just escape the pipes and the quotes:

rsh -l user machine "echo \"PORTS = 123\|456\|789\" >> conf.cfg"
于 2013-03-30T12:57:46.237 回答