<?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: Shell script needed Replace gecos field in /etc/passwd in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420602#M354418</link>
    <description>&amp;gt;Suraj: Could please let me know in /etc/passwd file where this field is located "gecos"&lt;BR /&gt;&lt;BR /&gt;$5 of course. ;-)&lt;BR /&gt;It's right there on passwd(4).&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-60130/passwd.4.html" target="_blank"&gt;http://docs.hp.com/en/B2355-60130/passwd.4.html&lt;/A&gt;</description>
    <pubDate>Fri, 15 May 2009 04:42:01 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2009-05-15T04:42:01Z</dc:date>
    <item>
      <title>Shell script needed Replace gecos field in /etc/passwd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420599#M354415</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;Iam into learning process of shell scripting, I need script to replace gecos field in /etc/passwd &lt;BR /&gt;im trying to read 2 files list1 and list2(list of userIDs) and compare with $1 field of /etc/passwd,if contents of list1 matches the /etc/passwd then and run chuser command to replace gecos field to FunctionlistValue else set ServiceListValue else notfound perform manual&lt;BR /&gt;&lt;BR /&gt;I have figured out something like this:&lt;BR /&gt;--------------------&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;Functionlist="code here"&lt;BR /&gt;servicelist="Code here"&lt;BR /&gt;if [cat /tmp/list1 $1= cat /etc/passwd $1]&lt;BR /&gt;then&lt;BR /&gt;echo "Found $1 in list1\\n"&lt;BR /&gt;/usr/bin/chuser -R $1 gecos=$Functionlist&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [cat /tmp/list2 $1= cat /etc/passwd $1]&lt;BR /&gt;then &lt;BR /&gt;echo"Found $1 in list2\\n"&lt;BR /&gt;/usr/bin/chuser -R $1 gecos=$servicelist&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;echo "User ID not found Please implement change manually \\n"&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;please correct my script</description>
      <pubDate>Fri, 15 May 2009 03:52:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420599#M354415</guid>
      <dc:creator>Shell script to replace</dc:creator>
      <dc:date>2009-05-15T03:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script needed Replace gecos field in /etc/passwd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420600#M354416</link>
      <description>HI,&lt;BR /&gt;&amp;gt;&amp;gt;I need script to replace gecos field in /etc/passwd &lt;BR /&gt;&lt;BR /&gt;Could please let me know in /etc/passwd file where this field is located "gecos"&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
      <pubDate>Fri, 15 May 2009 04:00:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420600#M354416</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2009-05-15T04:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script needed Replace gecos field in /etc/passwd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420601#M354417</link>
      <description>&lt;!--!*#--&gt;(You might want to change your forum name to something that you can use for more than one question.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;trying to read 2 files list1 and list2 (list of userIDs)&lt;BR /&gt;&lt;BR /&gt;What's in list1?  Also UIDs?&lt;BR /&gt;&lt;BR /&gt;Also, there is no such thing as chuser on HP-UX, there is chfn(1) but it prompts.&lt;BR /&gt;&lt;BR /&gt;while read uid; do&lt;BR /&gt;   /usr/bin/chuser -R $uid gecos="$Functionlist" &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;   if [ $? -eq 0 ]; then&lt;BR /&gt;      echo "Found $uid in list1"&lt;BR /&gt;   fi&lt;BR /&gt;done &amp;lt; /tmp/list1&lt;BR /&gt;&lt;BR /&gt;while read uid; do&lt;BR /&gt;    /usr/bin/chuser -R $uid gecos="$servicelist" &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;  if [ $? -eq 0 ]; then&lt;BR /&gt;      echo "Found $uid in list2"&lt;BR /&gt;   else&lt;BR /&gt;      echo "User ID ($uid) not found Please implement change manually"&lt;BR /&gt;   fi&lt;BR /&gt;done &amp;lt; /tmp/list2&lt;BR /&gt;&lt;BR /&gt;This assumes that the non-existent command chuser sets a bad exit status if $uid doesn't exist.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Suraj: Could please let me know in /etc/passwd file where this field is located "gecos"&lt;BR /&gt;&lt;BR /&gt;$5 of course. ;-)</description>
      <pubDate>Fri, 15 May 2009 04:40:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420601#M354417</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-05-15T04:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script needed Replace gecos field in /etc/passwd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420602#M354418</link>
      <description>&amp;gt;Suraj: Could please let me know in /etc/passwd file where this field is located "gecos"&lt;BR /&gt;&lt;BR /&gt;$5 of course. ;-)&lt;BR /&gt;It's right there on passwd(4).&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-60130/passwd.4.html" target="_blank"&gt;http://docs.hp.com/en/B2355-60130/passwd.4.html&lt;/A&gt;</description>
      <pubDate>Fri, 15 May 2009 04:42:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-needed-replace-gecos-field-in-etc-passwd/m-p/4420602#M354418</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-05-15T04:42:01Z</dc:date>
    </item>
  </channel>
</rss>

