Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
User Journal

Journal brlancer's Journal: Problems escaping quotes in SSH

I needed to loop through a whole bunch of machines today and run some commands that included nested perl stuff. No matter what I escaped, it continued to puke and complain about something new. What I discovered was that I could set an environment variable with the command I wanted to exec remotely and interpolate that into my ssh session--this required fewer escapes than otherwise.

$ x="perl -e 'print \"\$foo\n\";'" ; ssh bar.baz "$x"

Not sure how I missed this before--maybe I found another hack a decade ago and I've since forgotten.

(My real example involved lots more quotes and "special" characters. This is a huge shortcut for me.)

Software production is assumed to be a line function, but it is run like a staff function. -- Paul Licker

Working...