- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Floating point math in ksh93
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2007 03:52 AM
тАО08-07-2007 03:52 AM
I need to be able to convert MB into GB, e.q. if I have 19720 MB, I need to know that it's 19.3 GB, not just 19 as ksh reports.
Solved! Go to Solution.
- Tags:
- dtksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2007 04:08 AM
- Tags:
- typeset
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2007 09:15 PM
тАО08-07-2007 09:15 PM
Re: Floating point math in ksh93
19720 * 100 / 1024
Then you would have to add the "." before the 2 decimal places.
Or you could use awk to do the calculation.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2007 09:27 PM
тАО08-07-2007 09:27 PM
Re: Floating point math in ksh93
what would you do with decimals?
you can't compare them:
$ [[ 1.2 -eq 1.5 ]] && echo ok
ok
$ [[ 1.2 -gt 1.5 ]] && echo ok
$ [[ 2.2 -gt 1.5 ]] && echo ok
ok
$ [[ 2.2 -gt 2.5 ]] && echo ok
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2007 09:38 PM
тАО08-07-2007 09:38 PM
Re: Floating point math in ksh93
Did you read the subject?
Those commands work perfectly fine with /usr/dt/bin/dtksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2007 09:46 PM
тАО08-07-2007 09:46 PM
Re: Floating point math in ksh93
$ /usr/dt/bin/dtksh
$ echo $0
/usr/dt/bin/dtksh
$ [[ 1.2 -gt 1.1 ]] && echo ok
ok
$ [[ 1.1 -gt 1.1 ]] && echo ok
$ [[ 2.1 -gt 1.1 ]] && echo ok
ok
$ [[ 1.2 -eq 1.5 ]] && echo ok
$ [[ 1.2 -gt 1.5 ]] && echo ok
$ [[ 2.2 -gt 1.5 ]] && echo ok
ok
$ [[ 2.2 -gt 2.5 ]] && echo ok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 02:40 AM
тАО08-08-2007 02:40 AM
Re: Floating point math in ksh93
#!/usr/dt/bin/dtksh
# put your ksh code here
ksh93 has a lot of enhancements over ksh88 (the /usr/bin/ksh in HP-UX) and the POSIX shell /usr/bin/sh. There are also some forward incompatibilities so be aware that a few techniques may need some changes. The dtksh shell was provided with add-on features for Xwindows but it's most useful feature today is ksh93 enhancements.
Bill Hassell, sysadmin