Results 1 to 3 of 3
Hey guys, I'm new to linux and I'm trying to bring some korn shell code over from an HP-OS operating system. In HP, decimal numbers do not have to be ...
- 03-20-2008 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 1
ksh on linux - declaring decimals
Hey guys, I'm new to linux and I'm trying to bring some korn shell code over from an HP-OS operating system. In HP, decimal numbers do not have to be declared, but in linux I"m getting errors for the decimal points. Can someone tell me how to declare my variables? Something like:
integer abc=0
only for decimal numbers.
- 03-20-2008 #2Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
Welcome to the forum.
Producing:Code:#!/bin/ksh # @(#) s1 Demonstrate floating-point. # man ksh: float='typeset -lE' echo echo "(Version information from local command \"version\")" version >/dev/null 2>&1 && version =o $(_eat $0 $1) float a=1.1 typeset -lE b=3.3 echo printf " Difference between $b and $a is %f\n", $(( b-a )) exit $?
Best wishes ... cheers, drlCode:$ ./s1 (Version information from local command "version") Linux 2.6.22-3-686 ksh 93s+ Difference between 3.3 and 1.1 is 2.200000
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 03-21-2008 #3Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Are you using the real korn shell, or pdksh (a poor imitation, IMO)?


Reply With Quote