Is using expect and funneling your commands through an Expect script an option?  <br><br>--j<br><br><div class="gmail_quote">On Thu, Apr 9, 2009 at 12:56 PM, Jeff Lightner <span dir="ltr">&lt;<a href="mailto:jlightner@water.com">jlightner@water.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yes.  Because when I use the double quotes it tries to list the files on<br>
the local host rather than the remote one so results in:<br>
<br>
ls: /felix/preprod/jboss/server/default/log/log/webserver.log*: No such<br>
file or directory<br>
<br>
As I said I&#39;ve tried various quoting, escaping, eval methods.  The issue<br>
is they all make it either pass the variable (not its value) to the<br>
other side so it doesn&#39;t know the value or they evaluate parts of the<br>
command locally where they have no relevance.<br>
<br>
It just seems really odd to me that ssh doesn&#39;t have something built in<br>
that would allow it to process a locally defined variable on the remote<br>
side.  I see many have asked the question but didn&#39;t see any obvious<br>
solution.<br>
<div><div></div><div class="h5"><br>
-----Original Message-----<br>
From: <a href="mailto:ale-bounces@ale.org">ale-bounces@ale.org</a> [mailto:<a href="mailto:ale-bounces@ale.org">ale-bounces@ale.org</a>] On Behalf Of JK<br>
Sent: Thursday, April 09, 2009 12:20 PM<br>
To: Atlanta Linux Enthusiasts - Yes! We run Linux!<br>
Subject: Re: [ale] Using locally defined variable in ssh command line to<br>
remote host?<br>
<br>
Jeff Lightner wrote:<br>
&gt; Question:<br>
&gt;<br>
&gt; How can I create a variable in a script such that defining it on<br>
&gt; originating host allows me to feed it its value into the ssh command<br>
&gt; line on remote host?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Details:<br>
&gt;<br>
&gt; I&#39;m trying to do something like this:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #!bin/bash<br>
&gt;<br>
&gt; REMSERVER=billybob<br>
&gt;<br>
&gt; REMLOGDIR=/felix/preprod/jboss/server/default/log<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ssh $REMSERVER &#39;sh -c &quot;ls -tr  ${REMLOGDIR}/webserver.log* |xargs grep<br>
<br>
&gt; -hA 10 DEBUG&quot;&#39;<br>
<br>
<br>
Hmmm.  Problem is, your variable is inside a single-quoted string, so it<br>
isn&#39;t getting expanded on the local host.  Is there a specific reason<br>
you&#39;re not just saying<br>
<br>
ssh $REMSERVER &quot;ls -tr  ${REMLOGDIR}/webserver.log* |xargs grep<br>
-hA 10 DEBUG&quot;<br>
<br>
?<br>
<br>
<br>
-- JK<br>
<br>
--<br>
A closed mouth gathers no feet.<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
<br>
</div></div><div class="im">Please consider our environment before printing this e-mail or attachments.<br>
----------------------------------<br>
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.<br>

----------------------------------<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>---<br>Jerald M. Sheets jr.<br><br>