<?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: Scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079371#M440144</link>
    <description>Thanks James</description>
    <pubDate>Tue, 13 Nov 2007 09:00:18 GMT</pubDate>
    <dc:creator>Aggy</dc:creator>
    <dc:date>2007-11-13T09:00:18Z</dc:date>
    <item>
      <title>Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079369#M440142</link>
      <description>I have written a script to enable the account and disable it after the specified days expire, the issue is that many times the support guys just press enter and the script changes the password for the person logged in and running the script; see example below:&lt;BR /&gt;&lt;BR /&gt;/home/tst&amp;gt; ./enable_rw_acct.sh&lt;BR /&gt;Please type the user login for read-write access?&lt;BR /&gt; &lt;BR /&gt;For how long user wants access(in days)?&lt;BR /&gt; &lt;BR /&gt;./enable_rw_acct.sh[23]: test: Specify a parameter with this command.&lt;BR /&gt;modprpw: user password file not found: bootpw=NO,umaxlntr=-1,llog=-1,acctexp=&lt;BR /&gt;Access Granted to&lt;BR /&gt;Changing password for root&lt;BR /&gt;Old password:&lt;BR /&gt;&lt;BR /&gt;I do not want this to happen and if they do not enter the username or the number of days then the script should exit with some error message &lt;BR /&gt;&lt;BR /&gt;Below is my existing script whcih needs changing: &lt;BR /&gt;&lt;BR /&gt; echo "Please type the user login for read-write access?"&lt;BR /&gt;read USERNAME&lt;BR /&gt;loginid=`id $USERNAME`&lt;BR /&gt;if [[ $loginid = "" ]]&lt;BR /&gt;then&lt;BR /&gt;        echo&lt;BR /&gt;#&lt;BR /&gt; &lt;BR /&gt;echo "Please type the user login for read-write access?"&lt;BR /&gt;read USERNAME&lt;BR /&gt;loginid=`id $USERNAME`&lt;BR /&gt;if [[ $loginid = "" ]]&lt;BR /&gt;then&lt;BR /&gt;        echo&lt;BR /&gt;        echo "Login $loginid does not exists"&lt;BR /&gt;        echo&lt;BR /&gt;        echo "Script exiting . . . . ."&lt;BR /&gt;        exit 0&lt;BR /&gt;fi&lt;BR /&gt; &lt;BR /&gt;        echo "For how long user wants access(in days)?"&lt;BR /&gt;        read LENGTH&lt;BR /&gt;if [ $LENGTH -ge 15 ]&lt;BR /&gt;then&lt;BR /&gt;        echo "Read-Write access should not exceed 2 weeks.Try again !!!"&lt;BR /&gt;        exit&lt;BR /&gt;else&lt;BR /&gt;        /usr/lbin/modprpw -l -m bootpw=NO,umaxlntr=-1,llog=-1,acctexp=$LENGTH $U&lt;BR /&gt;SERNAME&lt;BR /&gt;        echo "Access Granted to $USERNAME"&lt;BR /&gt; &lt;BR /&gt;        passwd $USERNAME&lt;BR /&gt;        sleep 1&lt;BR /&gt;        passwd -f $USERNAME&lt;BR /&gt; &lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Nov 2007 08:04:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079369#M440142</guid>
      <dc:creator>Aggy</dc:creator>
      <dc:date>2007-11-13T08:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079370#M440143</link>
      <description>Hi Aggy:&lt;BR /&gt;&lt;BR /&gt;One way:&lt;BR /&gt;&lt;BR /&gt;# read REPLY; [ -z "${REPLY}" ] &amp;amp;&amp;amp; echo "Empty replies are not allowed!" || echo "ok"&lt;BR /&gt;&lt;BR /&gt;Modify your script appropriately to meet your goals.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 13 Nov 2007 08:08:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079370#M440143</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-11-13T08:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079371#M440144</link>
      <description>Thanks James</description>
      <pubDate>Tue, 13 Nov 2007 09:00:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/5079371#M440144</guid>
      <dc:creator>Aggy</dc:creator>
      <dc:date>2007-11-13T09:00:18Z</dc:date>
    </item>
  </channel>
</rss>

