Escaping pipe character in rsh
Asked Answered
S

1

8

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!

Staves answered 30/3, 2013 at 12:55 Comment(0)
Y
11

Just escape the pipes and the quotes:

rsh -l user machine "echo \"PORTS = 123\|456\|789\" >> conf.cfg"
Yount answered 30/3, 2013 at 12:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.