<?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 ksh - problems with comment parameter in useradd in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752512#M497096</link>
    <description>&lt;P&gt;I am trying to user useradd in a ksh script...&lt;/P&gt;&lt;PRE&gt;PG_USERNAME=postgres

PG_USER_ID=26

PG_GROUP_ID=26

PG_USER_SHELL='/bin/ksh'

PG_USER_DIR='/home/postgres'

PG_USER_COMMENT="\"Postgres administration account"\"

:

echo "useradd -u $PG_USER_ID -g $PG_GROUP_ID -d $PG_USER_DIR -m -s $PG_USER_SHELL -c $PG_USER_COMMENT $PG_USERNAME"

useradd -u $PG_USER_ID -g $PG_GROUP_ID -d $PG_USER_DIR -m -s $PG_USER_SHELL -c $PG_USER_COMMENT $PG_USERNAME

:&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the script,&amp;nbsp;I get...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;04-Jun-2015 12:37:19: Info: Creating Postgres user 'postgres' with UID '26'...&lt;/P&gt;&lt;P&gt;useradd -u 26 -g 26 -d /home/postgres -m -s /bin/ksh -c "Postgres administration account" postgres&lt;/P&gt;&lt;P&gt;Too Many Arguments specified&lt;/P&gt;&lt;P&gt;Usage: useradd [-u &amp;lt;uid&amp;gt; [-o]] [-g &amp;lt;group&amp;gt;] [-G &amp;lt;group&amp;gt;[,&amp;lt;group...&amp;gt;]] [-d &amp;lt;dir&amp;gt;] [-s &amp;lt;shell&amp;gt;] [-c &amp;lt;comment&amp;gt;] [-m [-k &amp;lt;skel dir&amp;gt;]] [-f &amp;lt;inactive&amp;gt;] [-e &amp;lt;expire&amp;gt;] [-r &amp;lt;yes|no&amp;gt;] [-p &amp;lt;encrypted-password&amp;gt;] [-t &amp;lt;template&amp;gt;] [-P -S &amp;lt;alternate password file&amp;gt;] &amp;lt;login&amp;gt;&lt;/P&gt;&lt;P&gt;Usage: useradd -D [-g &amp;lt;group&amp;gt;] [-b &amp;lt;base dir&amp;gt;] [-f &amp;lt;inactive&amp;gt;] [-e &amp;lt;expire&amp;gt;] [-r &amp;lt;yes|no&amp;gt;] [-M &amp;lt;yes/no&amp;gt;] [-k &amp;lt;skel dir&amp;gt;] [-O &amp;lt;yes/no&amp;gt;] [-s &amp;lt;shell&amp;gt;] [-c &amp;lt;comment&amp;gt;] [-t &amp;lt;template&amp;gt;]&lt;/P&gt;&lt;P&gt;04-Jun-2015 12:37:19: ERROR: Unable to create Postgres user postgres, error: 2&lt;/P&gt;&lt;P&gt;root@devp51:#&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Gary&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jun 2015 10:50:14 GMT</pubDate>
    <dc:creator>Gary Cooper_1</dc:creator>
    <dc:date>2015-06-04T10:50:14Z</dc:date>
    <item>
      <title>ksh - problems with comment parameter in useradd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752512#M497096</link>
      <description>&lt;P&gt;I am trying to user useradd in a ksh script...&lt;/P&gt;&lt;PRE&gt;PG_USERNAME=postgres

PG_USER_ID=26

PG_GROUP_ID=26

PG_USER_SHELL='/bin/ksh'

PG_USER_DIR='/home/postgres'

PG_USER_COMMENT="\"Postgres administration account"\"

:

echo "useradd -u $PG_USER_ID -g $PG_GROUP_ID -d $PG_USER_DIR -m -s $PG_USER_SHELL -c $PG_USER_COMMENT $PG_USERNAME"

useradd -u $PG_USER_ID -g $PG_GROUP_ID -d $PG_USER_DIR -m -s $PG_USER_SHELL -c $PG_USER_COMMENT $PG_USERNAME

:&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the script,&amp;nbsp;I get...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;04-Jun-2015 12:37:19: Info: Creating Postgres user 'postgres' with UID '26'...&lt;/P&gt;&lt;P&gt;useradd -u 26 -g 26 -d /home/postgres -m -s /bin/ksh -c "Postgres administration account" postgres&lt;/P&gt;&lt;P&gt;Too Many Arguments specified&lt;/P&gt;&lt;P&gt;Usage: useradd [-u &amp;lt;uid&amp;gt; [-o]] [-g &amp;lt;group&amp;gt;] [-G &amp;lt;group&amp;gt;[,&amp;lt;group...&amp;gt;]] [-d &amp;lt;dir&amp;gt;] [-s &amp;lt;shell&amp;gt;] [-c &amp;lt;comment&amp;gt;] [-m [-k &amp;lt;skel dir&amp;gt;]] [-f &amp;lt;inactive&amp;gt;] [-e &amp;lt;expire&amp;gt;] [-r &amp;lt;yes|no&amp;gt;] [-p &amp;lt;encrypted-password&amp;gt;] [-t &amp;lt;template&amp;gt;] [-P -S &amp;lt;alternate password file&amp;gt;] &amp;lt;login&amp;gt;&lt;/P&gt;&lt;P&gt;Usage: useradd -D [-g &amp;lt;group&amp;gt;] [-b &amp;lt;base dir&amp;gt;] [-f &amp;lt;inactive&amp;gt;] [-e &amp;lt;expire&amp;gt;] [-r &amp;lt;yes|no&amp;gt;] [-M &amp;lt;yes/no&amp;gt;] [-k &amp;lt;skel dir&amp;gt;] [-O &amp;lt;yes/no&amp;gt;] [-s &amp;lt;shell&amp;gt;] [-c &amp;lt;comment&amp;gt;] [-t &amp;lt;template&amp;gt;]&lt;/P&gt;&lt;P&gt;04-Jun-2015 12:37:19: ERROR: Unable to create Postgres user postgres, error: 2&lt;/P&gt;&lt;P&gt;root@devp51:#&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Gary&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 10:50:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752512#M497096</guid>
      <dc:creator>Gary Cooper_1</dc:creator>
      <dc:date>2015-06-04T10:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: ksh - problems with comment parameter in useradd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752537#M497097</link>
      <description>&lt;P&gt;PG_USER_COMMENT=\"Blah\"&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 12:14:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752537#M497097</guid>
      <dc:creator>mjkgard</dc:creator>
      <dc:date>2015-06-04T12:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: ksh - problems with comment parameter in useradd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752540#M497098</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PG_USER_COMMENT=\"Postgres administration account\"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I run it...&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;root@devp51:# ./create_pg_user&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;./create_pg_user[74]: administration: not found&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;04-Jun-2015 14:25:51: Info: Creating Postgres user 'postgres' with UID '26'...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;useradd -u 26 -g 26 -d /home/postgres -m -s /bin/ksh -c postgres&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Either -D or user must be specified&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Usage: useradd [-u &amp;lt;uid&amp;gt; [-o]] [-g &amp;lt;group&amp;gt;] [-G &amp;lt;group&amp;gt;[,&amp;lt;group...&amp;gt;]] [-d &amp;lt;dir&amp;gt;] [-s &amp;lt;shell&amp;gt;] [-c &amp;lt;comment&amp;gt;] [-m [-k &amp;lt;skel dir&amp;gt;]] [-f &amp;lt;inactive&amp;gt;] [-e &amp;lt;expire&amp;gt;] [-r &amp;lt;yes|no&amp;gt;] [-p &amp;lt;encrypted-password&amp;gt;] [-t &amp;lt;template&amp;gt;] [-P -S &amp;lt;alternate password file&amp;gt;] &amp;lt;login&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Usage: useradd -D [-g &amp;lt;group&amp;gt;] [-b &amp;lt;base dir&amp;gt;] [-f &amp;lt;inactive&amp;gt;] [-e &amp;lt;expire&amp;gt;] [-r &amp;lt;yes|no&amp;gt;] [-M &amp;lt;yes/no&amp;gt;] [-k &amp;lt;skel dir&amp;gt;] [-O &amp;lt;yes/no&amp;gt;] [-s &amp;lt;shell&amp;gt;] [-c &amp;lt;comment&amp;gt;] [-t &amp;lt;template&amp;gt;]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;04-Jun-2015 14:25:51: ERROR: Unable to create Postgres user postgres, error: 2&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;root@devp51:#&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 12:28:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752540#M497098</guid>
      <dc:creator>Gary Cooper_1</dc:creator>
      <dc:date>2015-06-04T12:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: ksh - problems with comment parameter in useradd</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752628#M497099</link>
      <description>&lt;P&gt;Here is what I got to work, based on your script snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#!/usr/bin/ksh -x
PG_USERNAME=pwwtest1

PG_USER_ID=2600

PG_GROUP_ID=2600

PG_USER_SHELL='/bin/ksh'

PG_USER_DIR='/home/pwwtest1'

PG_USER_COMMENT="Postgres administration account"

useradd -u $PG_USER_ID -g $PG_GROUP_ID -d $PG_USER_DIR -m -s $PG_USER_SHELL -c "$PG_USER_COMMENT" $PG_USERNAME&lt;/PRE&gt;&lt;P&gt;Notice that I just have one set of double-quotes around the PG_USER_COMMENT string and then I put double quotes around the variable $PG_USER_COMMENT in the command itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked and created the ID for me.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 16:14:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-problems-with-comment-parameter-in-useradd/m-p/6752628#M497099</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2015-06-04T16:14:14Z</dc:date>
    </item>
  </channel>
</rss>

