Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have 2 servers both ubuntu say serverA and serverB

I am running a shell command from serverA on the shell of serverB but it seems I need to do some escaping for the exact command to reach serverB. The command on serverB doesnt have & and anything after that. Is there anyways I can make sure exact command reaches the serverB:

I am doing this on serverA

ssh root@serverB 'processthis -a example.com/?a=1,2,3&m=a,b,c'

the actual command that needs to reach serverB is:

processthis -a example.com/?a=1,2,3&m=a,b,c

but the command that reaches there is

processthis -a example.com/?a=1,2,3

Thanks

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Try putting a double quote around the argument to processthis.

ssh root@serverB 'processthis -a "example.com/?a=1,2,3&m=a,b,c"'

share|improve this answer
    
Thanks I tried the double quote approach and it worked. Thanks –  Sparsh Gupta Mar 2 '11 at 16:31

You should escape the & with an \ as it gets treated by bash. Try this:

sh root@serverB 'processthis -a example.com/?a=1,2,3\&m=a,b,c'

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.