<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I guess that might be one way to go.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>However, I just realized on reading it on
the list that my last response (and the test I did that generated it) had a
typo.&nbsp; I had added &#8220;/log&#8221; after the variable but it is part of the
variable so expansion was making it &#8230;/log/log/&#8230; instead of just &#8230;/log/&#8230;
<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>On retesting without the typo it seems to
work with the double quotes.&nbsp; <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Apparently in one of my earlier iterations
(where I was doing something much more convoluted) I&#8217;d tried the double
quotes and they didn&#8217;t work so I hadn&#8217;t tried them after I got more
or less the right syntax (without variables).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
ale-bounces@ale.org [mailto:ale-bounces@ale.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Jerald Sheets<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, April 09, 2009
1:03 PM<br>
<b><span style='font-weight:bold'>To:</span></b> Atlanta Linux Enthusiasts -
Yes! We run Linux!<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [ale] Using locally
defined variable in ssh command line toremote host?</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Is using expect and
funneling your commands through an Expect script an option?&nbsp; <br>
<br>
--j<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Thu, Apr 9, 2009 at 12:56 PM, Jeff Lightner &lt;<a
href="mailto:jlightner@water.com">jlightner@water.com</a>&gt; wrote:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Yes. &nbsp;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've tried various quoting, escaping, eval methods. &nbsp;The issue<br>
is they all make it either pass the variable (not its value) to the<br>
other side so it doesn'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't have something built in<br>
that would allow it to process a locally defined variable on the remote<br>
side. &nbsp;I see many have asked the question but didn't see any obvious<br>
solution.<o:p></o:p></span></font></p>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><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'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 'sh -c &quot;ls -tr &nbsp;${REMLOGDIR}/webserver.log*
|xargs grep<br>
<br>
&gt; -hA 10 DEBUG&quot;'<br>
<br>
<br>
Hmmm. &nbsp;Problem is, your variable is inside a single-quoted string, so it<br>
isn't getting expanded on the local host. &nbsp;Is there a specific reason<br>
you're not just saying<br>
<br>
ssh $REMSERVER &quot;ls -tr &nbsp;${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><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>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>
----------------------------------<o:p></o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>_______________________________________________<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><o:p></o:p></span></font></p>

</div>

</div>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
<br clear=all>
<br>
-- <br>
---<br>
Jerald M. Sheets jr.<o:p></o:p></span></font></p>

</div>

</body>

</html>