<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ssh remote 'if' command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638783#M379211</link>
    <description>Well I'm sorry to say that I could not make any of your suggestions work, and ended up following SEP's advice by copying the script over and then executing it remotely.&lt;BR /&gt;&lt;BR /&gt;I think all of you failed to take into consideration the use of the '\' character before special characters like '['.  A very important syntax rule when using either ssh or remsh.  Except for James, who touched on it, but I could not get James' suggestion to work either.&lt;BR /&gt;&lt;BR /&gt;I will leave this open if anyone wants to continue fiddling with it.  &lt;BR /&gt;&lt;BR /&gt;Please trap and paste in your output so I can see the test run successes.&lt;BR /&gt;&lt;BR /&gt;Thanks to you All!</description>
    <pubDate>Fri, 28 May 2010 12:45:19 GMT</pubDate>
    <dc:creator>Michael Steele_2</dc:creator>
    <dc:date>2010-05-28T12:45:19Z</dc:date>
    <item>
      <title>ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638777#M379205</link>
      <description>Hello:&lt;BR /&gt;&lt;BR /&gt;In running remote commands via ssh I've had many successes but not with an if conditional.  Can anyone make this work with ssh?&lt;BR /&gt;&lt;BR /&gt;Note:  Its not a password problem my authorized_keys file is up to day.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ssh -l $LOGNAME $hostname "if [[ ! -f /etc/profile ]] then&lt;BR /&gt;      MAX="Number"&lt;BR /&gt;fi"&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!</description>
      <pubDate>Thu, 27 May 2010 13:44:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638777#M379205</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2010-05-27T13:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638778#M379206</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You could do:&lt;BR /&gt;&lt;BR /&gt;# ssh -l ${LOGNAME} ${hostname} -n "[ -f /etc/profile ] &amp;amp;&amp;amp; echo 1 || echo 0" &amp;gt; /tmp/returned&lt;BR /&gt;&lt;BR /&gt;...and then examine the value in the '/tmp/returned' file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 27 May 2010 14:12:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638778#M379206</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-05-27T14:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638779#M379207</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;I think JRF is right, the problem is that the environment is not sourced.&lt;BR /&gt;&lt;BR /&gt;I'd recommend merely calling a script with return value(code to send it) that does this work.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 27 May 2010 14:54:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638779#M379207</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-05-27T14:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638780#M379208</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Preventing the local shell from interpolating variables is also very important in situations like this.  You may need to use single quotes or escape characters to accommodate your needs.&lt;BR /&gt;&lt;BR /&gt;Consider:&lt;BR /&gt;&lt;BR /&gt;# ssh -l myuser myhost -n 'MAX=0;[ -f /etc/profile ] &amp;amp;&amp;amp; MAX=1;echo ${MAX}' &amp;gt; /tmp/returned&lt;BR /&gt;&lt;BR /&gt;...works to return 0 or 1 in the file on the local server.&lt;BR /&gt;&lt;BR /&gt;...whereas:&lt;BR /&gt;&lt;BR /&gt;# ssh -l myuser myhost -n "MAX=0;[ -f /etc/profile ] &amp;amp;&amp;amp; MAX=1;echo ${MAX}" &amp;gt; /tmp/returned &lt;BR /&gt;&lt;BR /&gt;...does not.&lt;BR /&gt;&lt;BR /&gt;However, you could do:&lt;BR /&gt;&lt;BR /&gt;# ssh -l myuser myhost -n "MAX=0;[ -f /etc/profile ] &amp;amp;&amp;amp; MAX=1;echo \${MAX}" &amp;gt; /tmp/returned&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 27 May 2010 15:20:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638780#M379208</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-05-27T15:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638781#M379209</link>
      <description>Or, you can:&lt;BR /&gt;ssh -l $LOGNAME $hostname "if [[ ! -f /etc/profile ]] then MAX=Number; fi"&lt;BR /&gt;</description>
      <pubDate>Thu, 27 May 2010 16:25:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638781#M379209</guid>
      <dc:creator>Tingli</dc:creator>
      <dc:date>2010-05-27T16:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638782#M379210</link>
      <description>&amp;gt;Tingli: Or, you can:&lt;BR /&gt;&lt;BR /&gt;You need a ";" before the "then".&lt;BR /&gt;ssh -l $LOGNAME $hostname "if [[ ! -f /etc/profile ]]; then MAX=Number; fi"&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 May 2010 10:52:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638782#M379210</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-05-28T10:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: ssh remote 'if' command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638783#M379211</link>
      <description>Well I'm sorry to say that I could not make any of your suggestions work, and ended up following SEP's advice by copying the script over and then executing it remotely.&lt;BR /&gt;&lt;BR /&gt;I think all of you failed to take into consideration the use of the '\' character before special characters like '['.  A very important syntax rule when using either ssh or remsh.  Except for James, who touched on it, but I could not get James' suggestion to work either.&lt;BR /&gt;&lt;BR /&gt;I will leave this open if anyone wants to continue fiddling with it.  &lt;BR /&gt;&lt;BR /&gt;Please trap and paste in your output so I can see the test run successes.&lt;BR /&gt;&lt;BR /&gt;Thanks to you All!</description>
      <pubDate>Fri, 28 May 2010 12:45:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-remote-if-command/m-p/4638783#M379211</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2010-05-28T12:45:19Z</dc:date>
    </item>
  </channel>
</rss>

