[nycbug-talk] Stupid mistake ... just checking :)

Matt Juszczak matt at atopia.net
Wed Jul 21 10:54:56 EDT 2010


I was indeed using -x as I always do, but the output wasn't indicative of backticks - or at least, I wasn't interpreting the output as problematic. 


------Original Message------
From: N.J. Thomas
To: Matt Juszczak
Cc: talk at lists.nycbug.org
Subject: Re: [nycbug-talk] Stupid mistake ... just checking :)
Sent: Jul 21, 2010 10:52

* Matt Juszczak <matt at atopia.net> [2010-07-21 02:08:43-0400]:
> `ssh blah.hoarf.com`
> I spent hours debugging it after I kept getting errors that "Last" was an 
> invalid command.

Whenever you are debugging shell scripts, "set -e" and "set -x" are your
best friends. Dollars to donuts you have would have found that error in
60 seconds with both of those turned on. =-)

> The only possibility something would have been executed by "rogue output" 
> would have been locally on my laptop right?  The only way something would 
> have been executed on the remote server is if I would have typed it in 

Correct. Whatever the output of "ssh host" was would have been executed
on your laptop (I'm assuming it was mostly garbage that was not
meaningful to your shell script); but not on the server.

The only exception to this rule is if somehow "ssh host" produced
textual output (like from /etc/motd maybe) to the effect of "ssh host
<meaningful command>" but that is highly unlikely, and you can double
check this by running "ssh host" yourself and seeing if any such string


More information about the talk mailing list