Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Once I run into nested escape wrangling I start to seriously question how I'm trying to accomplish something.


Once I run into nested escape wrangling I seriously question the sanity of my tools.


If I can't fix it in like 3 tries, I switch to my local shell script having the script to run on the remote end be in a HEREDOC and just scp it it over and then ssh exec it. Inside the HEREDOC, it's a sane environment.


Copying over the commands to run also has another added benefit, you have quite good documentation of what was run and when. Also it allows one to easily run a failing thing again (in case output gets mangled in the executing script)


And idempotency is essential for shell scripts that alter state. Otherwise you have to keep track of where failures happened.


wrap it in base64 then cat it | ssh « base64 -d | bash »


`printf '%q'` is your friend.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: