<?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: Running cmds via SSH in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997556#M423845</link>
    <description>Patrick,&lt;BR /&gt;&lt;BR /&gt;Use double quotes instead.&lt;BR /&gt;&lt;BR /&gt;ssh -n hostname "/usr/sbin/ioscan -funC disk | while read a b; do [[ $b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo $b; done | sed '/vendor/d'"</description>
    <pubDate>Tue, 15 Aug 2006 14:16:21 GMT</pubDate>
    <dc:creator>Patrick Wallek</dc:creator>
    <dc:date>2006-08-15T14:16:21Z</dc:date>
    <item>
      <title>Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997555#M423844</link>
      <description>Hello.&lt;BR /&gt;&lt;BR /&gt;I'm trying to issue the following cmd via SSH. &lt;BR /&gt;&lt;BR /&gt;ssh -n hostname /usr/sbin/ioscan -funC disk | while read a b; do [[ $b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo $b; done | sed '/vendor/d'&lt;BR /&gt;&lt;BR /&gt;This doesn't work because instead of launching the 'diskinfo' on the remote host, it's launched in the localshell, trying to diskinfo devices that might not exist on localhost!&lt;BR /&gt;&lt;BR /&gt;The fix is to put the entire cmd between quotes like so:&lt;BR /&gt;&lt;BR /&gt;ssh -n hostname '/usr/sbin/ioscan -funC disk | while read a b; do [[ $b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo $b; done | sed '/vendor/d''&lt;BR /&gt;&lt;BR /&gt;HOWEVER, this is where I've got a problem. My sed part already uses single quotes, and I cannot escape them. If I remove the sed part, all works exactly has expected! &lt;BR /&gt;&lt;BR /&gt;I'm trying to see how this can be accomplised *without* the need to write a script on the remote servers... &lt;BR /&gt;&lt;BR /&gt;P.s.: don't question on why that cmd.. I know it's pretty useless. It's just an example of some things I'd like to do...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Patrick&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2006 14:12:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997555#M423844</guid>
      <dc:creator>PatRoy</dc:creator>
      <dc:date>2006-08-15T14:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997556#M423845</link>
      <description>Patrick,&lt;BR /&gt;&lt;BR /&gt;Use double quotes instead.&lt;BR /&gt;&lt;BR /&gt;ssh -n hostname "/usr/sbin/ioscan -funC disk | while read a b; do [[ $b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo $b; done | sed '/vendor/d'"</description>
      <pubDate>Tue, 15 Aug 2006 14:16:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997556#M423845</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-08-15T14:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997557#M423846</link>
      <description>I already thought of that and no that doesn't work either:&lt;BR /&gt;&lt;BR /&gt;sh: Syntax error at line 1 : `/dev/rdsk/*' is not expected.&lt;BR /&gt;&lt;BR /&gt;is what I get in return</description>
      <pubDate>Tue, 15 Aug 2006 14:20:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997557#M423846</guid>
      <dc:creator>PatRoy</dc:creator>
      <dc:date>2006-08-15T14:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997558#M423847</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In the example you gave, the sed command works without quotes:&lt;BR /&gt;&lt;BR /&gt;ssh -n hostname '/usr/sbin/ioscan -funC disk | while read a b; do [[ $b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo $b; done | sed /vendor/d'&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Tue, 15 Aug 2006 14:20:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997558#M423847</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-08-15T14:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997559#M423848</link>
      <description>Shalom Patrick,&lt;BR /&gt;&lt;BR /&gt;Few things to look at.&lt;BR /&gt;&lt;BR /&gt;Some systems don't provide environment properly, so make sure PATH and such is set.&lt;BR /&gt;&lt;BR /&gt;Enclose commands in double quotes.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;ssh root@hostname "ls -lrt *.iso"&lt;BR /&gt;&lt;BR /&gt;For complex commands including say awk the \ for special characters will permit quotes within quotes.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 15 Aug 2006 14:21:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997559#M423848</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-08-15T14:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997560#M423849</link>
      <description>You're right! it does work.&lt;BR /&gt;&lt;BR /&gt;But now, what if I wanted to add an &lt;BR /&gt;&lt;BR /&gt;awk '{print $2}' &lt;BR /&gt;&lt;BR /&gt;?  &lt;BR /&gt;&lt;BR /&gt;I need to do a bunch a little scripts which collects various server information from approx. 17-18 servers.. (i.e BDFs, vgdisplay, etc.). That's why I need a bunch of theses...</description>
      <pubDate>Tue, 15 Aug 2006 14:26:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997560#M423849</guid>
      <dc:creator>PatRoy</dc:creator>
      <dc:date>2006-08-15T14:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997561#M423850</link>
      <description>Steven E. Protter, no in cannot use '\' to escape my quotes. I've already tried that...&lt;BR /&gt;&lt;BR /&gt;and has for having double quotes and even trying to escape my single quote won't do:&lt;BR /&gt;&lt;BR /&gt;ssh -n host "/usr/sbin/ioscan -funC disk | while read a b; do [[ $b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo $b; done | awk \'{print $2}\'"&lt;BR /&gt;&lt;BR /&gt;gives me:&lt;BR /&gt;sh: 2: Parameter not set</description>
      <pubDate>Tue, 15 Aug 2006 14:30:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997561#M423850</guid>
      <dc:creator>PatRoy</dc:creator>
      <dc:date>2006-08-15T14:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997562#M423851</link>
      <description>Patrick,&lt;BR /&gt;&lt;BR /&gt;Use double-quotes, then single-quotes, and escape special characters, such as $.&lt;BR /&gt;&lt;BR /&gt;Also, I believe the error you reported in your second posting was caused by not escaping (\) the LF between lines.&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Tue, 15 Aug 2006 14:39:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997562#M423851</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-08-15T14:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997563#M423852</link>
      <description>spex, you've got it.&lt;BR /&gt;&lt;BR /&gt;the following worked:&lt;BR /&gt;&lt;BR /&gt;ssh -n host "/usr/sbin/ioscan -funC disk | while read a b; do [[ \$b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo \$b; done | awk '{print \$1}'"&lt;BR /&gt;&lt;BR /&gt;and so does something like:&lt;BR /&gt;&lt;BR /&gt;ssh -n host "/usr/sbin/ioscan -funC disk | while read a b; do [[ \$b = /dev/rdsk/* ]] &amp;amp;&amp;amp; /usr/sbin/diskinfo \$b; done | sed '/vendor/d'"&lt;BR /&gt;&lt;BR /&gt;so basically, when using double quotes, it's only $ I need to escape, and not the ' single quotes.&lt;BR /&gt;&lt;BR /&gt;thanks again!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2006 14:45:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997563#M423852</guid>
      <dc:creator>PatRoy</dc:creator>
      <dc:date>2006-08-15T14:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Running cmds via SSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997564#M423853</link>
      <description>as per last msg.</description>
      <pubDate>Tue, 15 Aug 2006 14:56:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-cmds-via-ssh/m-p/4997564#M423853</guid>
      <dc:creator>PatRoy</dc:creator>
      <dc:date>2006-08-15T14:56:38Z</dc:date>
    </item>
  </channel>
</rss>

