<?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: ksh script problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749487#M834403</link>
    <description>As it seems the problems have already been identifyed I would just like to point out that when debugging scripts, it's oftern verry usefull to insert 'set -x' at the start of the script. Or run it with 'sh -x myscript'. That way you will see what the script executes and evaluates.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Trond</description>
    <pubDate>Fri, 21 Jun 2002 05:36:21 GMT</pubDate>
    <dc:creator>Trond Haugen</dc:creator>
    <dc:date>2002-06-21T05:36:21Z</dc:date>
    <item>
      <title>ksh script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749483#M834399</link>
      <description>HI,&lt;BR /&gt;&lt;BR /&gt;I've inserted .ksh file for the purpose of changing the numeric user ids of several users in a filesystem.&lt;BR /&gt;&lt;BR /&gt;Problem is, it contains errors listed below whenever I try executing it:&lt;BR /&gt;ChangeUID.ksh[3]: =: not found&lt;BR /&gt;ChangeUID.ksh[7]: =: not found&lt;BR /&gt;Test&lt;BR /&gt;ChangeUID.ksh[17]: =: not found&lt;BR /&gt;uname =&lt;BR /&gt;ypmatch: 1831-150 Cannot match key passwd.byname in map file&lt;BR /&gt;Reason: no such map file in server's domain.&lt;BR /&gt;ChangeUID.ksh[20]: =: not found&lt;BR /&gt;uid =&lt;BR /&gt;ChangeUID.ksh[23]: =: not found&lt;BR /&gt;file = &lt;BR /&gt;not within specified range&lt;BR /&gt;Test&lt;BR /&gt;...... and the same block of errors just keeps repeating itself for other entries in the text file fileList.txt.&lt;BR /&gt;&lt;BR /&gt;I've tried running the exact ypmatch portion over the console, &amp;amp; it works OK, but not during execution of the script.&lt;BR /&gt;&lt;BR /&gt;Can  anyone help?&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jun 2002 03:35:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749483#M834399</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-06-21T03:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749484#M834400</link>
      <description>It looks like a lot of basics are not correct in your script. First ..&lt;BR /&gt;&lt;BR /&gt;if ["$?" !="0"]&lt;BR /&gt;&lt;BR /&gt;should be&lt;BR /&gt;&lt;BR /&gt;if (($? != 0))&lt;BR /&gt;&lt;BR /&gt;since you're evaluation numbers you can use "((". Then your variable assignments are all wrong ..&lt;BR /&gt;&lt;BR /&gt;$uname = `echo $line |awk '{print $3}'`&lt;BR /&gt;&lt;BR /&gt;should be (use some other name because uname is a command but that's besides the point, if you want to assign a value to a variable don;t use $ in that variable until you want to call it later)&lt;BR /&gt;&lt;BR /&gt;username=`echo $line | awk '{print $3}'`&lt;BR /&gt;&lt;BR /&gt;Next ..&lt;BR /&gt;&lt;BR /&gt;$mypasswdfile = `ypmatch $3 passwd.byname &amp;gt; passwd file`&lt;BR /&gt;&lt;BR /&gt;..here you are redirecting output from ypmatch to a file "passwd" and "file" ? And at the same time you want to assign file filename to a variable ..? Not sure what you're trying to do here. I think this is what you actually wanted ?&lt;BR /&gt;&lt;BR /&gt;ypmatch $3 passwd.byname &amp;gt; passwd-file&lt;BR /&gt;mypasswdfile=passwd-file&lt;BR /&gt;&lt;BR /&gt;Then ..&lt;BR /&gt;&lt;BR /&gt;$uid = `id $uname`&lt;BR /&gt;&lt;BR /&gt;same argument ... no "$" sign ..&lt;BR /&gt;&lt;BR /&gt;UID=`id $username`&lt;BR /&gt;&lt;BR /&gt;and it goes on ..&lt;BR /&gt;&lt;BR /&gt;It would be better if you can show the content of "fileList.txt" and describe again what you want the script to do and if it's not me, someone else will come up with a workable script for you.&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jun 2002 04:12:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749484#M834400</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-06-21T04:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749485#M834401</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Two major syntax mistakes (I am not looking at the semantics):&lt;BR /&gt;&lt;BR /&gt;1) you should not but a dollar sign for the variable name in the assignment. That is perl syntax, not ksh syntax. Example:&lt;BR /&gt;&lt;BR /&gt;Instead of:&lt;BR /&gt;&lt;BR /&gt;$allowedDir = /usr/home/oper1/cleaw/UID&lt;BR /&gt;&lt;BR /&gt;It should be:&lt;BR /&gt;&lt;BR /&gt;allowedDir = /usr/home/oper1/cleaw/UID&lt;BR /&gt;&lt;BR /&gt;2) There must be a space between then starting [ and ", a space between = and " and a space between the ending " and ]. Example:&lt;BR /&gt;&lt;BR /&gt;Instead of:&lt;BR /&gt;&lt;BR /&gt;if ["$?" !="0"]&lt;BR /&gt;&lt;BR /&gt;It should be:&lt;BR /&gt;&lt;BR /&gt;if [ "$?" != "0" ]&lt;BR /&gt;&lt;BR /&gt;Once this is fixed, the syntax errors listed on lines 3, 7, 17, 20, 23 will be fixed.&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Fri, 21 Jun 2002 04:37:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749485#M834401</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-06-21T04:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749486#M834402</link>
      <description>Hi Steven &amp;amp; SK,&lt;BR /&gt;&lt;BR /&gt;I forgot to include the file "fileList.txt"&lt;BR /&gt;It is an output from 'ls -l'.&lt;BR /&gt;&lt;BR /&gt;I'm including it in this reply message.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jun 2002 05:02:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749486#M834402</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-06-21T05:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749487#M834403</link>
      <description>As it seems the problems have already been identifyed I would just like to point out that when debugging scripts, it's oftern verry usefull to insert 'set -x' at the start of the script. Or run it with 'sh -x myscript'. That way you will see what the script executes and evaluates.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Trond</description>
      <pubDate>Fri, 21 Jun 2002 05:36:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749487#M834403</guid>
      <dc:creator>Trond Haugen</dc:creator>
      <dc:date>2002-06-21T05:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749488#M834404</link>
      <description>One:&lt;BR /&gt;if ["$?" !="0"]    should be:&lt;BR /&gt;if [ "$?" != "0" ] (use spaces)&lt;BR /&gt;&lt;BR /&gt;Two:&lt;BR /&gt;$uname = `echo ..` should be:&lt;BR /&gt;uname=`echo ..` (no $ in ksh)&lt;BR /&gt;(and other cases...)&lt;BR /&gt;&lt;BR /&gt;So.. take care of your spaces and $-signs in Ksh.&lt;BR /&gt;&lt;BR /&gt;In short:&lt;BR /&gt;var=`uname -a`; echo $var&lt;BR /&gt;and not:&lt;BR /&gt;var = `uname -a`; echo $var&lt;BR /&gt;and not:&lt;BR /&gt;$var = `uname -a; echo $var&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ceesjan</description>
      <pubDate>Fri, 21 Jun 2002 07:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-problem/m-p/2749488#M834404</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-06-21T07:11:39Z</dc:date>
    </item>
  </channel>
</rss>

