<?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 script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289750#M181929</link>
    <description>Here's one that I just wrote to do this.  In addition to what you wanted, if a field is not specified on the command line it prompts for it.&lt;BR /&gt;&lt;BR /&gt;Hope it helps.&lt;BR /&gt;&lt;BR /&gt;Gary</description>
    <pubDate>Fri, 28 May 2004 06:57:21 GMT</pubDate>
    <dc:creator>Gary L. Paveza, Jr.</dc:creator>
    <dc:date>2004-05-28T06:57:21Z</dc:date>
    <item>
      <title>useradd script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289747#M181926</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I want to write one useradd shell script which will customised useradd command.&lt;BR /&gt;My script also ask for ftp user, cron user setup and according to it will &lt;BR /&gt;add ftpuser, cron user in respective files.&lt;BR /&gt;&lt;BR /&gt;Also i want to write script in such a way that options will be in any order, &lt;BR /&gt;i mean, like below:&lt;BR /&gt;&lt;BR /&gt;useradd.sh -g &lt;GRP&gt; -s &lt;SHELL&gt; -c "comment" -d &lt;HOMEDIR&gt; -m login&lt;BR /&gt;&lt;BR /&gt;Or&lt;BR /&gt;useradd.sh -s &lt;SHELL&gt; -u &lt;UID&gt; -d &lt;HOMEDIR&gt; -c "comment" -g &lt;GRP&gt; login&lt;BR /&gt;or&lt;BR /&gt;useradd login&lt;BR /&gt;&lt;BR /&gt;The missing options will be the default settings.&lt;BR /&gt;&lt;BR /&gt;How can i write in my script that which argument for &lt;GRP&gt; , which is&lt;BR /&gt;for &lt;SHELL&gt; , which is for &lt;HOMEDIR&gt; , which is for ...bla bla bla?&amp;amp;lt;BR /&amp;amp;gt;&amp;amp;lt;BR /&amp;amp;gt;Please assist.&amp;amp;lt;BR /&amp;amp;gt;&amp;amp;lt;BR /&amp;amp;gt;With regards&amp;amp;lt;BR /&amp;amp;gt;Tapas&lt;/HOMEDIR&gt;&lt;/SHELL&gt;&lt;/GRP&gt;&lt;/GRP&gt;&lt;/HOMEDIR&gt;&lt;/UID&gt;&lt;/SHELL&gt;&lt;/HOMEDIR&gt;&lt;/SHELL&gt;&lt;/GRP&gt;</description>
      <pubDate>Fri, 28 May 2004 06:04:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289747#M181926</guid>
      <dc:creator>Tapas Jha</dc:creator>
      <dc:date>2004-05-28T06:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289748#M181927</link>
      <description>Tapas,&lt;BR /&gt;&lt;BR /&gt;Check the manpage of getopts.&lt;BR /&gt;It contains an interesting example too.&lt;BR /&gt;&lt;BR /&gt;JP</description>
      <pubDate>Fri, 28 May 2004 06:19:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289748#M181927</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-05-28T06:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289749#M181928</link>
      <description>Hi Tapas,&lt;BR /&gt;&lt;BR /&gt;you will have to test your input parameters.&lt;BR /&gt;eg. if %1 is -s then %2 is shell. You hae to do this for all your input parameters.&lt;BR /&gt;There are a lot of different ways in which you can do this.&lt;BR /&gt;The if methed may be easiest to understand but it will require a lot of if statements.&lt;BR /&gt;Using another method like "case" would be better but everyone's got different preferences when scripting.&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Fri, 28 May 2004 06:23:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289749#M181928</guid>
      <dc:creator>Bart Paulusse</dc:creator>
      <dc:date>2004-05-28T06:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289750#M181929</link>
      <description>Here's one that I just wrote to do this.  In addition to what you wanted, if a field is not specified on the command line it prompts for it.&lt;BR /&gt;&lt;BR /&gt;Hope it helps.&lt;BR /&gt;&lt;BR /&gt;Gary</description>
      <pubDate>Fri, 28 May 2004 06:57:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289750#M181929</guid>
      <dc:creator>Gary L. Paveza, Jr.</dc:creator>
      <dc:date>2004-05-28T06:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289751#M181930</link>
      <description>Hey Tapas,&lt;BR /&gt;Need more information.  Are you wanting this script to be interactive or did you want the user to just type all of the info on a command line?&lt;BR /&gt;&lt;BR /&gt;If you are looking for an interactive script, you could use something like this, but you would have to provide some error checking to ensure a valid shell is entered, a uid or gid is not being duplicated, etc.&lt;BR /&gt;&lt;BR /&gt;echo "\nPlease enter username:"&lt;BR /&gt; read username&lt;BR /&gt;echo "\nPlease enter user id: "&lt;BR /&gt; read userid&lt;BR /&gt;echo "\nPlease enter group: "&lt;BR /&gt; read group&lt;BR /&gt;echo "\nPlease enter shell: "&lt;BR /&gt; read shell&lt;BR /&gt;echo "\nPlease enter home directory: "&lt;BR /&gt; read homedirectory&lt;BR /&gt;echo "\nPlease enter comment: "&lt;BR /&gt; read comment&lt;BR /&gt;echo "\nPlease enter username:"&lt;BR /&gt; read username&lt;BR /&gt;echo "\nPlease enter user id: "&lt;BR /&gt; read userid&lt;BR /&gt;echo "\nPlease enter group: "&lt;BR /&gt; read group&lt;BR /&gt;echo "\nPlease enter shell: "&lt;BR /&gt; read shell&lt;BR /&gt;echo "\nPlease enter home directory: "&lt;BR /&gt; read homedirectory&lt;BR /&gt;echo "\nPlease enter comment: "&lt;BR /&gt; read comment&lt;BR /&gt;useradd $username -u $userid -g $group -s $shell -d $homedirectory -c $comment"&lt;BR /&gt;&lt;BR /&gt;You could even dump the info to a file so you can see all of the information that the user supplies:&lt;BR /&gt;&lt;BR /&gt;echo "useradd $username -u $userid -g $group -s $shell -d $homedirectory -c $comment" &amp;gt;/tmp/useradd.test</description>
      <pubDate>Fri, 28 May 2004 08:55:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289751#M181930</guid>
      <dc:creator>Dani Seely</dc:creator>
      <dc:date>2004-05-28T08:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: useradd script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289752#M181931</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Don't forget about SAM. You can use an additional script which is called from SAM before and/or after user's creation. You can put into the script all additional features.&lt;BR /&gt;HTH</description>
      <pubDate>Fri, 28 May 2004 09:07:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/useradd-script-help/m-p/3289752#M181931</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2004-05-28T09:07:04Z</dc:date>
    </item>
  </channel>
</rss>

