remote ssh execution puzzle

Phil Meyer pmeyer at themeyerfarm.com
Fri Apr 13 16:44:14 UTC 2007


The days of senility must be approaching ..  Surely this has been solved 
and resolved many years ago.

$ ssh otherhost "uptime | awk '{print $1}'"

Statement of observation:
    The local shell dutifully passes the text string including a $1 to 
the ssh program. 
    However, the ssh program insists on expanding $1 BEFORE it attempts 
the remote execution. 
    Therefore, it is impossible for the text string '$1' to appear on 
the remote command line.

In the example above, the remote command is:
    uptime | awk '{print  }'

Assuming that ssh respects special character escapes; all manner of 
escapes, double dollars, quote combinations, etc were attempted.  No 
magical combination was found.

What am I missing?  My youth?  My Mind?

Thanks for playing.




More information about the users mailing list