<?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: script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026900#M131771</link>
    <description>Hello!&lt;BR /&gt;&lt;BR /&gt;Try this in csh:&lt;BR /&gt;&lt;BR /&gt;foreach host (`cat hostfile`)&lt;BR /&gt;  remsh $host model&lt;BR /&gt;end&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
    <pubDate>Thu, 17 Jul 2003 20:24:44 GMT</pubDate>
    <dc:creator>Caesar_3</dc:creator>
    <dc:date>2003-07-17T20:24:44Z</dc:date>
    <item>
      <title>script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026897#M131768</link>
      <description>Hi! I do not know what wrong with this simple script.&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;  remsh $line model&lt;BR /&gt;done &amp;lt; hostfile&lt;BR /&gt;&lt;BR /&gt;I want to read the hostname from hostfile and run the command for each host. It runs for first host and comes out of loop.&lt;BR /&gt;If I replace command "remsh $line model" with "echo $line" it displays all the hosts.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2003 20:07:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026897#M131768</guid>
      <dc:creator>GK_5</dc:creator>
      <dc:date>2003-07-17T20:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026898#M131769</link>
      <description>Hi Ganesh,&lt;BR /&gt;&lt;BR /&gt;The problems you receive are related to the way remsh works.  Try the following:-&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;remsh $line -n "model"&lt;BR /&gt;done &amp;lt; hostfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Paul.</description>
      <pubDate>Thu, 17 Jul 2003 20:16:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026898#M131769</guid>
      <dc:creator>Paul Murray_4</dc:creator>
      <dc:date>2003-07-17T20:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026899#M131770</link>
      <description>for x in 'more hostfile'&lt;BR /&gt;do&lt;BR /&gt;remsh $x model&lt;BR /&gt;done</description>
      <pubDate>Thu, 17 Jul 2003 20:18:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026899#M131770</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-07-17T20:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026900#M131771</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;Try this in csh:&lt;BR /&gt;&lt;BR /&gt;foreach host (`cat hostfile`)&lt;BR /&gt;  remsh $host model&lt;BR /&gt;end&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Thu, 17 Jul 2003 20:24:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026900#M131771</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-07-17T20:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026901#M131772</link>
      <description>Hi,&lt;BR /&gt;apart from others hint,&lt;BR /&gt;how is the file "hostfile" structure ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is it like&lt;BR /&gt;&lt;BR /&gt;node1&lt;BR /&gt;node2&lt;BR /&gt;node2&lt;BR /&gt;&lt;BR /&gt;or different ?&lt;BR /&gt;&lt;BR /&gt;I think that your situation was&lt;BR /&gt;&lt;BR /&gt;node1 node2 node3 &lt;BR /&gt;&lt;BR /&gt;this way the command read get only the first node, node1.&lt;BR /&gt;&lt;BR /&gt;If you want to do the loop for all of them,&lt;BR /&gt;or you use a $( cat hostfile ) or change its structure.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the read command works in a slight different manner than you think.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;read var1 var2 var3&lt;BR /&gt;&lt;BR /&gt;reads a line of input, and put first field in var1, second in var2 and ALL other input in var3.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;  Massimo&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2003 06:03:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026901#M131772</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-07-18T06:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026902#M131773</link>
      <description>#!/bin/sh &lt;BR /&gt;&lt;BR /&gt;HOSTLST=/tmp/hosts.lst &lt;BR /&gt;&lt;BR /&gt;for host in $(cat $HOSTLST) &lt;BR /&gt;do &lt;BR /&gt;&amp;lt; run your commands here &amp;gt; &lt;BR /&gt;done &lt;BR /&gt;exit 0 &lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2003 06:14:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026902#M131773</guid>
      <dc:creator>twang</dc:creator>
      <dc:date>2003-07-18T06:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026903#M131774</link>
      <description>In addition what Massimo said:&lt;BR /&gt;"... read var1 var2 var3 &lt;BR /&gt;&lt;BR /&gt;reads a line of input, and put first field in var1, second in var2 and ALL other input in var3....&lt;BR /&gt;&lt;BR /&gt;that sounds that read can only process three variables. But this is not correct. Here what the manpage from read says to this:&lt;BR /&gt;&lt;BR /&gt;read reads a single line from standard input.  The line is split into fields as when processed by the shell (refer to shells in SEE ALSO); the first field is assigned to the first variable var, the second field to the second variable var, and so forth.  If there are more fields than there are specified var operands, the remaining fields and their intervening separators are assigned to the last var.  If there are more vars than fields, the remaining vars are set to empty strings. &lt;BR /&gt;&lt;BR /&gt;Hey Massimo, I think you mean it like this :-}}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Roland&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2003 06:40:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026903#M131774</guid>
      <dc:creator>RolandH</dc:creator>
      <dc:date>2003-07-18T06:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026904#M131775</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;You can have comments and blanks in /etc/hosts&lt;BR /&gt;&lt;BR /&gt;grep -v "#" /etc/hosts|strings|while read ip name&lt;BR /&gt;do&lt;BR /&gt;remsh $name model&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Or if your file contains only hosts then&lt;BR /&gt;cat hostfile|while read line&lt;BR /&gt;do&lt;BR /&gt;remsh $line model&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Your solution reads all in 1 line with &amp;lt;&lt;BR /&gt;&lt;BR /&gt;            Steve Steel</description>
      <pubDate>Fri, 18 Jul 2003 07:00:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026904#M131775</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2003-07-18T07:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026905#M131776</link>
      <description>Hi,&lt;BR /&gt;Roland, you are perfectly right, i wanted to give an example, but forgot to mention it :)&lt;BR /&gt;&lt;BR /&gt;Thanks for the remark.&lt;BR /&gt;&lt;BR /&gt;Massimo&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2003 07:03:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3026905#M131776</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-07-18T07:03:51Z</dc:date>
    </item>
  </channel>
</rss>

