<?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 shell script doubt in for loop in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422586#M354531</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt; I want to create a shell script to find that is particular user available in what are the servers.&lt;BR /&gt;&lt;BR /&gt; we are lot of hp-ux server. some users are created in some servers and not created in some servers.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; so from being one hp-ux server i want to see this.&lt;BR /&gt;&lt;BR /&gt; rlogin is enabled in all the servers.&lt;BR /&gt;&lt;BR /&gt; and in rhosts file of the all the servers has the entry for connecting server (from which i am going to search the users.)&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 19 May 2009 12:35:32 GMT</pubDate>
    <dc:creator>senthil_kumar_1</dc:creator>
    <dc:date>2009-05-19T12:35:32Z</dc:date>
    <item>
      <title>shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422586#M354531</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt; I want to create a shell script to find that is particular user available in what are the servers.&lt;BR /&gt;&lt;BR /&gt; we are lot of hp-ux server. some users are created in some servers and not created in some servers.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; so from being one hp-ux server i want to see this.&lt;BR /&gt;&lt;BR /&gt; rlogin is enabled in all the servers.&lt;BR /&gt;&lt;BR /&gt; and in rhosts file of the all the servers has the entry for connecting server (from which i am going to search the users.)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 May 2009 12:35:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422586#M354531</guid>
      <dc:creator>senthil_kumar_1</dc:creator>
      <dc:date>2009-05-19T12:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422587#M354532</link>
      <description>ok...so that's what you want to do, but what's your question?  Have you attempted to write anything yet?&lt;BR /&gt;&lt;BR /&gt;if not, one way might be&lt;BR /&gt;&lt;BR /&gt;read "username" from command line parm&lt;BR /&gt;File w/ list of "servers"&lt;BR /&gt;for servername in above list&lt;BR /&gt;remsh &lt;SERVERNAME&gt; grep ^username: /etc/password&lt;BR /&gt;&lt;BR /&gt;details and implementation are left as an exercise.&lt;BR /&gt;&lt;BR /&gt;there are other ways, and remsh / rlogin isn't secure.&lt;BR /&gt;&lt;/SERVERNAME&gt;</description>
      <pubDate>Tue, 19 May 2009 12:47:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422587#M354532</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-05-19T12:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422588#M354533</link>
      <description>Hey;&lt;BR /&gt;&lt;BR /&gt;If nothing's been configured/started already, then don't start out using rlogin/remsh.  With a little bit of pre-work, you can use secure shell/public key authentication to get the same results with greater security and flexibility.&lt;BR /&gt;&lt;BR /&gt;Do a search in itrc for procedures on configuring ssh/pka.  It's relatively simple.&lt;BR /&gt;&lt;BR /&gt;Once that's done, you can then do something like the following:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;User=$1&lt;BR /&gt;[[ ${#User} -eq 0 ]] &amp;amp;&amp;amp; exit 1&lt;BR /&gt;&lt;BR /&gt;for h in $(cat list-of-hosts-file)&lt;BR /&gt;do&lt;BR /&gt;l=$(ssh ${h} grep "^${User}:" /etc/passwd &amp;gt; 2&amp;gt;/dev/null)&lt;BR /&gt;printf "%-8s %s\n" ${h} "${l:=Not defined}"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope that helps.&lt;BR /&gt;&lt;BR /&gt;Doug&lt;BR /&gt;</description>
      <pubDate>Tue, 19 May 2009 12:58:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422588#M354533</guid>
      <dc:creator>Doug O'Leary</dc:creator>
      <dc:date>2009-05-19T12:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422589#M354534</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Ok, here's one way.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset USER=$1&lt;BR /&gt;while read HOST X&lt;BR /&gt;do&lt;BR /&gt;    RESULT=$(rsh ${HOST} -n grep ^${USER}: /etc/passwd)&lt;BR /&gt;    if [ -z "${RESULT}" ]; then&lt;BR /&gt;        echo "${USER} missing on ${HOST}"&lt;BR /&gt;    else&lt;BR /&gt;        echo "${USER} exists on ${HOST}"&lt;BR /&gt;    fi&lt;BR /&gt;done &amp;lt; /tmp/hosts&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;The '/tmp/hosts' file contains a hostname (one per line).&lt;BR /&gt;&lt;BR /&gt;Now go examine the manpages for 'rsh' and note the use of the '-n' option.  Notice that while I used a simple 'grep' I anchor what I want to match to the beginning of a line with the caret (^) symbol and specify the ":" to limit the match at the end of the string I want to be significant.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 19 May 2009 13:05:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422589#M354534</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-05-19T13:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422590#M354535</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Oops!  Replace "rsh" with 'remsh' in my script.  "rsh" = Restricted Shell.  "remsh" stands for "remote shell".&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 19 May 2009 16:38:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422590#M354535</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-05-19T16:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422591#M354536</link>
      <description>Acutally i am using folllwoing method to find the users for single server.&lt;BR /&gt;&lt;BR /&gt;Ex:&lt;BR /&gt;&lt;BR /&gt;I am entering the following command directly in command prompt.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;for i in 10.250.0.2&lt;BR /&gt;&amp;gt;do&lt;BR /&gt;&amp;gt;ssh $i "grep john /etc/passwd&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;So the above command is working fine for singel system&lt;BR /&gt;&lt;BR /&gt;But i have lot of system.&lt;BR /&gt;&lt;BR /&gt;So I created a file called "servers" and mentioned all the servers' ip address in that file. &lt;BR /&gt;&lt;BR /&gt;Then i mentioned that file like &lt;BR /&gt;&lt;BR /&gt;&amp;gt;for i in /root/servers&lt;BR /&gt;&amp;gt;do&lt;BR /&gt;&amp;gt;ssh $i "grep john /etc/passwd&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How to solve this.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 May 2009 18:21:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422591#M354536</guid>
      <dc:creator>senthil_kumar_1</dc:creator>
      <dc:date>2009-05-19T18:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422592#M354537</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; How to solve this.&lt;BR /&gt;&lt;BR /&gt;If yuo are already using 'ssh' in lieu of 'remsh' then, very good.&lt;BR /&gt;&lt;BR /&gt;Both Doug and I showed you how to use a file containing a list of servers.  Read what has been posted.&lt;BR /&gt;&lt;BR /&gt;Too, your 'grep' will match things you don't want to match!  Again, _READ_ what I said about matching to the beginning of a line and only up to a colon (":")!&lt;BR /&gt;&lt;BR /&gt;You already have the answer to your question.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 19 May 2009 18:28:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422592#M354537</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-05-19T18:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422593#M354538</link>
      <description>Hi,&lt;BR /&gt;&amp;gt;for i in /root/servers&lt;BR /&gt;&amp;gt;do&lt;BR /&gt;&amp;gt;ssh $i "grep john /etc/passwd&lt;BR /&gt;&amp;gt;done&lt;BR /&gt;&lt;BR /&gt;you have to do like this way&lt;BR /&gt;for i in `cat /root/servers`&lt;BR /&gt;do&lt;BR /&gt;ssh $i grep john /etc/passwd&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
      <pubDate>Wed, 20 May 2009 04:33:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422593#M354538</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2009-05-20T04:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: shell script doubt in for loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422594#M354539</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;check below link for shell,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-90046/ch14s03.html" target="_blank"&gt;http://docs.hp.com/en/B2355-90046/ch14s03.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;if helps,pls assign pont.&lt;BR /&gt;&lt;BR /&gt;Rgds//&lt;BR /&gt;Taifur</description>
      <pubDate>Wed, 20 May 2009 06:26:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-doubt-in-for-loop/m-p/4422594#M354539</guid>
      <dc:creator>Taifur</dc:creator>
      <dc:date>2009-05-20T06:26:20Z</dc:date>
    </item>
  </channel>
</rss>

