HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ksh - variable size limitation
Operating System - HP-UX
1833827
Members
2047
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
11-17-2009 11:30 PM
11-17-2009 11:30 PM
ksh - variable size limitation
Hello experts,
It looks like ksh doesn't support variable sizes equal or greater than 2GB (2147483648)
for e.g.,
# SIZE=1073741824
# VALUE=17179869184
# if [ $SIZE -lt $VALUE ]
> then
> echo "not ok"
> else
> echo "ok"
> fi
ok
Where as output should be "not ok"
This is happening because input to the variable VALUE is greater than 2 GB.
# VALUE=17179869184; echo $VALUE
0
Is there any way to overcome this limitation and define variable to accept values greather than 2GB ?
I tried typeset -E & -F, but not working
I know "bc" don't have such limitation, but I can't pass values directly to "bc", because these variables assigned values after some calculations and expressions, unlike I mentioned above where I assigned values directly to simplify
Thanks,
Satish.
It looks like ksh doesn't support variable sizes equal or greater than 2GB (2147483648)
for e.g.,
# SIZE=1073741824
# VALUE=17179869184
# if [ $SIZE -lt $VALUE ]
> then
> echo "not ok"
> else
> echo "ok"
> fi
ok
Where as output should be "not ok"
This is happening because input to the variable VALUE is greater than 2 GB.
# VALUE=17179869184; echo $VALUE
0
Is there any way to overcome this limitation and define variable to accept values greather than 2GB ?
I tried typeset -E & -F, but not working
I know "bc" don't have such limitation, but I can't pass values directly to "bc", because these variables assigned values after some calculations and expressions, unlike I mentioned above where I assigned values directly to simplify
Thanks,
Satish.
Difference between good and the best is only a little effort
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2009 12:10 AM
11-18-2009 12:10 AM
Re: ksh - variable size limitation
>It looks like ksh doesn't support variable sizes equal or greater than 2GB (2147483648)
Right. On 11.23, ksh handles 64 bit arithmetic. But the Posix shell only has 32 bit.
>I tried typeset -E & -F, but not working
/usr/dt/bin/dtksh supports them.
>but I can't pass values directly to "bc"
Why not? You can pass them in a here document.
Right. On 11.23, ksh handles 64 bit arithmetic. But the Posix shell only has 32 bit.
>I tried typeset -E & -F, but not working
/usr/dt/bin/dtksh supports them.
>but I can't pass values directly to "bc"
Why not? You can pass them in a here document.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2009 12:25 AM
11-18-2009 12:25 AM
Re: ksh - variable size limitation
CDE not installed on our server, so dtksh doesn't exist
Difference between good and the best is only a little effort
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP