Operating System - HP-UX
1753947
Members
7838
Online
108811
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
Discussions
Discussions
Forums
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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
тАО04-07-2004 01:25 AM
тАО04-07-2004 01:25 AM
Hi,
I am adding up like this
one=01
adding + 05 using
let one=$one+05. I get output 6 which is correct. I want to get it as 06 instead of 6.
Any help would be appreciated.
Thanks.
I am adding up like this
one=01
adding + 05 using
let one=$one+05. I get output 6 which is correct. I want to get it as 06 instead of 6.
Any help would be appreciated.
Thanks.
Never quit
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2004 01:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2004 01:39 AM
тАО04-07-2004 01:39 AM
Re: addition
Well you might output it using "printf" and a format or you could do
[[ $RESULT -le 10 ]] && $RESULT="0$RESULT"
probably better ways though
[[ $RESULT -le 10 ]] && $RESULT="0$RESULT"
probably better ways though
Never preceed any demonstration with anything more predictive than "watch this"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2004 02:17 AM
тАО04-07-2004 02:17 AM
Re: addition
The typeset shell command will do what you want:
#!/usr/bin/sh
typeset -i10 one=01
((one += 05))
echo "One = ${one}"
# Now let's apply a typeset
typeset -Z2 one
echo "Now one = ${one}"
NOTE: You could also apply a typeset for a new variable used only for display:
typeset -i10 one=01
((one += 05))
echo "One = ${one}"
# Now let's apply a typeset
typeset -Z2 newone=${one}
echo "Newone = ${newone}"
#!/usr/bin/sh
typeset -i10 one=01
((one += 05))
echo "One = ${one}"
# Now let's apply a typeset
typeset -Z2 one
echo "Now one = ${one}"
NOTE: You could also apply a typeset for a new variable used only for display:
typeset -i10 one=01
((one += 05))
echo "One = ${one}"
# Now let's apply a typeset
typeset -Z2 newone=${one}
echo "Newone = ${newone}"
If it ain't broke, I can fix that.
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP