<?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: integer math in ksh in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051049#M94282</link>
    <description>&lt;!--!*#--&gt;&lt;BR /&gt;The following works on the command line, but doesn't work in the shell script. The exact line that blows up is the multiplication line. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;# find total space available in each VG&lt;BR /&gt;&lt;BR /&gt;for VG in `strings /etc/lvmtab |grep -v dsk`&lt;BR /&gt;do&lt;BR /&gt;     echo processing $VG&lt;BR /&gt;     TOTAL_PE=`vgdisplay -v $VG | grep ^"Total PE"         | awk '{print $3}'`&lt;BR /&gt;&lt;BR /&gt;     PE_SIZE=`vgdisplay -v $VG | grep ^"PE Size (Mbytes)" | awk '{print $4}'`&lt;BR /&gt;&lt;BR /&gt;     echo TOTAL_PE_=$TOTAL_PE&lt;BR /&gt;     echo PE_SIZE=$PE_SIZE&lt;BR /&gt;&lt;BR /&gt;      ((TOTAL_SIZE=$TOTAL_PE * $PE_SIZE)) # does not work in ksh&lt;BR /&gt;#     ((TOTAL_SIZE=$TOTAL_PE * $PE_SIZE))   # works in dtksh&lt;BR /&gt;&lt;BR /&gt;     echo TOTAL_SIZE=$TOTAL_SIZE&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 07 Aug 2007 09:01:58 GMT</pubDate>
    <dc:creator>dictum9</dc:creator>
    <dc:date>2007-08-07T09:01:58Z</dc:date>
    <item>
      <title>integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051046#M94279</link>
      <description>How does one multiple two variables in standard ksh?&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2007 08:44:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051046#M94279</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2007-08-07T08:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051047#M94280</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# X=2;Y=8;Z=$((X*Y));echo ${Z}&lt;BR /&gt;16&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Aug 2007 08:49:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051047#M94280</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-07T08:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051048#M94281</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...I should add that if you are doing arithmetic in a shell, 'typeset'ing your variables to integers speeds things up a bit, too:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;typeset -i X=2&lt;BR /&gt;typeset -i Y=8&lt;BR /&gt;typeset -i Z&lt;BR /&gt;Z=$((X*Y))&lt;BR /&gt;echo ${Z}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Aug 2007 08:53:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051048#M94281</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-07T08:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051049#M94282</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;The following works on the command line, but doesn't work in the shell script. The exact line that blows up is the multiplication line. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;# find total space available in each VG&lt;BR /&gt;&lt;BR /&gt;for VG in `strings /etc/lvmtab |grep -v dsk`&lt;BR /&gt;do&lt;BR /&gt;     echo processing $VG&lt;BR /&gt;     TOTAL_PE=`vgdisplay -v $VG | grep ^"Total PE"         | awk '{print $3}'`&lt;BR /&gt;&lt;BR /&gt;     PE_SIZE=`vgdisplay -v $VG | grep ^"PE Size (Mbytes)" | awk '{print $4}'`&lt;BR /&gt;&lt;BR /&gt;     echo TOTAL_PE_=$TOTAL_PE&lt;BR /&gt;     echo PE_SIZE=$PE_SIZE&lt;BR /&gt;&lt;BR /&gt;      ((TOTAL_SIZE=$TOTAL_PE * $PE_SIZE)) # does not work in ksh&lt;BR /&gt;#     ((TOTAL_SIZE=$TOTAL_PE * $PE_SIZE))   # works in dtksh&lt;BR /&gt;&lt;BR /&gt;     echo TOTAL_SIZE=$TOTAL_SIZE&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2007 09:01:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051049#M94282</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2007-08-07T09:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051050#M94283</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;change this:&lt;BR /&gt;  ((TOTAL_SIZE=$TOTAL_PE * $PE_SIZE))&lt;BR /&gt;to this:&lt;BR /&gt;&lt;BR /&gt;  TOTAL_SIZE=$(( ${TOTAL_PE} * ${PE_SIZE} ))&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 07 Aug 2007 09:05:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051050#M94283</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-08-07T09:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051051#M94284</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Exactly what error do you see?  This works for me.  You could try running with a trace:&lt;BR /&gt;&lt;BR /&gt;# ksh -x my.sh 2&amp;gt;&amp;amp;1|more&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Aug 2007 09:13:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051051#M94284</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-07T09:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051052#M94285</link>
      <description>Oviwan,&lt;BR /&gt;&lt;BR /&gt;this worked beautifully, thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2007 09:30:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051052#M94285</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2007-08-07T09:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: integer math in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051053#M94286</link>
      <description>James Ferguson,&lt;BR /&gt;&lt;BR /&gt;that one works well also:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; total_size=$((total_pe*pe_size))&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2007 09:36:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/integer-math-in-ksh/m-p/4051053#M94286</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2007-08-07T09:36:22Z</dc:date>
    </item>
  </channel>
</rss>

