<?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: useradd several users in a script ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264170#M177536</link>
    <description>Clay, &lt;BR /&gt;I like your method of using awk to put the comment line in the end. That works great. Good point!! and Thanks a bunch.I used that and it works.&lt;BR /&gt;Cheryl,&lt;BR /&gt;I got some good hints (especially Sridhar suggestions) from the link you provided but Clay method gave me exactly what I wanted.&lt;BR /&gt;Appreciate it Clay, cheryl.</description>
    <pubDate>Fri, 30 Apr 2004 11:51:55 GMT</pubDate>
    <dc:creator>Sammy_2</dc:creator>
    <dc:date>2004-04-30T11:51:55Z</dc:date>
    <item>
      <title>useradd several users in a script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264166#M177532</link>
      <description>Hi,&lt;BR /&gt;Have a text file (see example in the bottom of the message).&lt;BR /&gt;&lt;BR /&gt;How do I script it so I don't have to do it manually ?&lt;BR /&gt;====================&lt;BR /&gt;while `cat userlist`&lt;BR /&gt;do&lt;BR /&gt;useradd -u $3 -g users -c "$1" -d /home/$2 -m $2 &lt;BR /&gt;==================&lt;BR /&gt;done&lt;BR /&gt;( I believe $1 will trip me here so I can't use space as a delimeter, because of first name and last name).&lt;BR /&gt;----------------&lt;BR /&gt;# cat userlist&lt;BR /&gt;Joe Smow    jose214        345&lt;BR /&gt;Mike Jones   mike123       346&lt;BR /&gt;San Kumar    san233        347&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Apr 2004 09:32:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264166#M177532</guid>
      <dc:creator>Sammy_2</dc:creator>
      <dc:date>2004-04-30T09:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: useradd several users in a script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264167#M177533</link>
      <description>FYI,&lt;BR /&gt;Some of these names have middle initial. And there is more than 3 spaces between the full name(joe Smow) , username id(joe214), and uid(345).&lt;BR /&gt;=================&lt;BR /&gt;# cat userlist&lt;BR /&gt;Joe Smow        joe214            345&lt;BR /&gt;Mike Jones      mike123           346&lt;BR /&gt;San Kumar       san233            347&lt;BR /&gt;Saml L. Jacks   samu234           348&lt;BR /&gt;Jo S mike       joe232            349&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Apr 2004 09:42:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264167#M177533</guid>
      <dc:creator>Sammy_2</dc:creator>
      <dc:date>2004-04-30T09:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: useradd several users in a script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264168#M177534</link>
      <description>Well, you are in the ballpark. However, you shot yourself in the foot by putting the full name as the first field(s). If I can trust you to ALWAYS use EXACTLY two name fields then this will work:&lt;BR /&gt;&lt;BR /&gt;cat userlist | while read NAME1 NAME2 XLOGIN XUID&lt;BR /&gt;do&lt;BR /&gt;useradd -u ${XUID} -g users -c "${NAME1} ${NAME2}" -d /home/${XLOGIN} -m ${XLOGIN}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;The better answer would be to put the comment field (Full Names) LAST in each line because read assigns everything leftover to the last variable listed:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat userlist | while read XLOGIN XUID NAME&lt;BR /&gt;do&lt;BR /&gt;useradd -u ${XUID} -g users -c "${NAME}"  -d /home/${XLOGIN} -m ${XLOGIN}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Rather than rearranging the order of field in your userlist, you could use awk to do the same thing.&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Apr 2004 09:44:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264168#M177534</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-30T09:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: useradd several users in a script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264169#M177535</link>
      <description>See also&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=29109" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=29109&lt;/A&gt;</description>
      <pubDate>Fri, 30 Apr 2004 09:55:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264169#M177535</guid>
      <dc:creator>Cheryl Griffin</dc:creator>
      <dc:date>2004-04-30T09:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: useradd several users in a script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264170#M177536</link>
      <description>Clay, &lt;BR /&gt;I like your method of using awk to put the comment line in the end. That works great. Good point!! and Thanks a bunch.I used that and it works.&lt;BR /&gt;Cheryl,&lt;BR /&gt;I got some good hints (especially Sridhar suggestions) from the link you provided but Clay method gave me exactly what I wanted.&lt;BR /&gt;Appreciate it Clay, cheryl.</description>
      <pubDate>Fri, 30 Apr 2004 11:51:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-several-users-in-a-script/m-p/3264170#M177536</guid>
      <dc:creator>Sammy_2</dc:creator>
      <dc:date>2004-04-30T11:51:55Z</dc:date>
    </item>
  </channel>
</rss>

