<?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: A simple script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948445#M796322</link>
    <description>Augusto,&lt;BR /&gt;You do not want to use the syntax &lt;BR /&gt;  $(( command ))&lt;BR /&gt;in your script - this will only evaluate a real numeric expression, it won't execute the command.  &lt;BR /&gt;&lt;BR /&gt;You should use either&lt;BR /&gt;  `command`&lt;BR /&gt;OR&lt;BR /&gt;  $(command)</description>
    <pubDate>Thu, 22 Dec 2005 10:12:07 GMT</pubDate>
    <dc:creator>Greg Vaidman</dc:creator>
    <dc:date>2005-12-22T10:12:07Z</dc:date>
    <item>
      <title>A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948439#M796313</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have written a simple script but don´t work. This is the script:&lt;BR /&gt;&lt;BR /&gt;$ cat f_get_count.sh&lt;BR /&gt;funct_get_count(){&lt;BR /&gt;tcount='$ORACLE_HOME/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;  connect / as sysdba&lt;BR /&gt;  set heading off&lt;BR /&gt;  set feedback off&lt;BR /&gt;  select count(*) from dba_users;&lt;BR /&gt;  exit&lt;BR /&gt;EOF'&lt;BR /&gt;&lt;BR /&gt;if [ $tcount!=0 ]; then&lt;BR /&gt;echo "Number of rows: $tcount"&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;funct_get_count&lt;BR /&gt;&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;$ f_get_count.sh&lt;BR /&gt;f_get_count.sh[9]: -s: A test command parameter is not valid.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Cesar (Brazil)</description>
      <pubDate>Thu, 22 Dec 2005 06:36:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948439#M796313</guid>
      <dc:creator>Augusto César</dc:creator>
      <dc:date>2005-12-22T06:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948440#M796315</link>
      <description>if [ $tcount!=0 ]; then&lt;BR /&gt;&lt;BR /&gt;You need spaces in your test clause.  Change it to: -&lt;BR /&gt;&lt;BR /&gt;if [ $tcount != 0 ]; then&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Dec 2005 06:41:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948440#M796315</guid>
      <dc:creator>Simon Hargrave</dc:creator>
      <dc:date>2005-12-22T06:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948441#M796317</link>
      <description>How about this ? &lt;BR /&gt;&lt;BR /&gt;unct_get_count(){&lt;BR /&gt;tcount='$ORACLE_HOME/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF'&lt;BR /&gt;&lt;BR /&gt;if [ $tcount != 0 ]; then&lt;BR /&gt;echo "Number of rows: $tcount"&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;funct_get_count&lt;BR /&gt;&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;You need to have spaces when doing comparison.&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Thu, 22 Dec 2005 06:45:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948441#M796317</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-12-22T06:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948442#M796319</link>
      <description>what are you trying to do here?&lt;BR /&gt;&lt;BR /&gt;tcount='$ORACLE_HOME/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF'&lt;BR /&gt;&lt;BR /&gt;It will declare a variable tcount with that contents.&lt;BR /&gt;&lt;BR /&gt;You have to try as,&lt;BR /&gt;&lt;BR /&gt;tcount=$($ORACLE_HOME/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF)&lt;BR /&gt;&lt;BR /&gt;Change script as,&lt;BR /&gt;&lt;BR /&gt;tcount=$($ORACLE_HOME/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF)&lt;BR /&gt;&lt;BR /&gt;if [ $tcount -ne 0 ]; then&lt;BR /&gt;echo "Number of rows: $tcount"&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;funct_get_count&lt;BR /&gt;&lt;BR /&gt;################################</description>
      <pubDate>Thu, 22 Dec 2005 06:53:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948442#M796319</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-22T06:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948443#M796320</link>
      <description>Change to correct one as,&lt;BR /&gt;&lt;BR /&gt;tcount=$((&lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;))&lt;BR /&gt;&lt;BR /&gt;if [ $tcount -ne 0 ]; then&lt;BR /&gt;echo "Number of rows: $tcount"&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;# START&lt;BR /&gt;funct_get_count&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Dec 2005 06:58:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948443#M796320</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-22T06:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948444#M796321</link>
      <description>Forgive me for not to explain the script. The script connects with Oracle and shows the number of users in database. I made some modifications but still it does not works.&lt;BR /&gt;&lt;BR /&gt;$ cat f_get_count.sh&lt;BR /&gt;funct_get_count(){&lt;BR /&gt;tcount=$((/u01/app/oracle/product/9.2.0.1.0/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;))&lt;BR /&gt;&lt;BR /&gt;if [ $tcount -ne 0 ]; then&lt;BR /&gt;echo "Number of rows: $tcount"&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;funct_get_count&lt;BR /&gt;&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;$ f_get_count.sh&lt;BR /&gt;f_get_count.sh[8]: /u01/app/oracle/product/9.2.0.1.0/bin/sqlplus -s &amp;lt;&amp;lt; EOF^Jconn&lt;BR /&gt;ect / as sysdba^Jset heading off^Jset feedback off^Jselect count(*) from dba_use&lt;BR /&gt;rs;^Jexit^JEOF^J: Syntax error&lt;BR /&gt;&lt;BR /&gt;ps: Sorry for my English.</description>
      <pubDate>Thu, 22 Dec 2005 08:45:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948444#M796321</guid>
      <dc:creator>Augusto César</dc:creator>
      <dc:date>2005-12-22T08:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948445#M796322</link>
      <description>Augusto,&lt;BR /&gt;You do not want to use the syntax &lt;BR /&gt;  $(( command ))&lt;BR /&gt;in your script - this will only evaluate a real numeric expression, it won't execute the command.  &lt;BR /&gt;&lt;BR /&gt;You should use either&lt;BR /&gt;  `command`&lt;BR /&gt;OR&lt;BR /&gt;  $(command)</description>
      <pubDate>Thu, 22 Dec 2005 10:12:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948445#M796322</guid>
      <dc:creator>Greg Vaidman</dc:creator>
      <dc:date>2005-12-22T10:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: A simple script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948446#M796323</link>
      <description>Works!!! This is the right script:&lt;BR /&gt;&lt;BR /&gt;funct_get_count(){&lt;BR /&gt;tcount=$(/u01/app/oracle/product/9.2.0.1.0/bin/sqlplus -s &amp;lt;&amp;lt; EOF&lt;BR /&gt;connect / as sysdba&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;select count(*) from dba_users;&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;if [ $tcount -ne 0 ]; then&lt;BR /&gt;echo "Number of rows: $tcount"&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;funct_get_count&lt;BR /&gt;&lt;BR /&gt;################################&lt;BR /&gt;&lt;BR /&gt;$ f_get_count.sh&lt;BR /&gt;Number of rows:&lt;BR /&gt;&lt;BR /&gt;        46&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you all!!&lt;BR /&gt;&lt;BR /&gt;Augusto</description>
      <pubDate>Thu, 22 Dec 2005 12:52:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-simple-script/m-p/4948446#M796323</guid>
      <dc:creator>Augusto César</dc:creator>
      <dc:date>2005-12-22T12:52:20Z</dc:date>
    </item>
  </channel>
</rss>

