Quote:
Originally Posted by
cfajohnson
[indent]
First, format your code so that it is more easily readable:
Apologies for the formatting. I've been wrestling with this for a while. I assure you the actual production copy will be properly formatted, but this was me wiping everything out and going back through and adding one line at a time, trying to find the point of failure.
Quote:
Then quote variable references
I'm not sure what you mean by quote your variable references. I thought that I had, but it's possible that I may have missed something.
Quote:
You have 6 calls to grep and two to awk for every iteration of the loop. It would probably be more efficient to process the input before entering the loop, but you haven't supplied the contents of $SESSIONS, so it may not be.
I'm aware of (and loathe) the number of external processes that are being called by this, but at the moment I'm more concerned with completing the logic of what I'm trying to do than with optimization. I hate sloppy scripting, but in this case I'm working on a deadline, and honestly, for the amount of info processed vs the power of the machine I'm working with...it's a secondary concern (but my OCD won't let me leave it if I can find a better way). I just didn't want to waste the boards time with cleanup...I can do that. Or at least try and come back.
Quote:
It shouldn't in this case (because there's a command), but ssh normally reads from the standard input, so it would read the entire output of "echo".
If the problem persists after fixing the quoting, try adding the -n option to ssh.
Someone else has mentioned the -n option and I think it's worth a shot. I've already left the office, so I'll have to give it a try in the moring.
Quote:
That could make quoting even more problematic, unless it is only the command itself in the variable and not the arguments.
I'm hoping it won't be an issue. As I said, the variable should just be value=$(ssh yadda|yadda) but I suppose I'll see in the morning.
Thanks for all your input though. Much appreciated.