LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-16-2007, 01:40 PM   #1
ya3784
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
How do you define a 2 digit numeric counter?


In Unix it is defined something like

integer counter Z2=00

When you increment it by 5 (eg. counter = $counter+5)
echi $counter gives 05. I need to define a variable with precisely 2 digits


Thx
 
Old 07-16-2007, 01:42 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
don't know what you're trying to achieve, but i wouldn't... i'd probably use printf to format it on demand to a 2 digit string at print time.
 
Old 07-16-2007, 01:45 PM   #3
ya3784
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Original Poster
Rep: Reputation: 0
I thought printf is C not Unix or Linux
 
Old 07-16-2007, 03:09 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
it's both.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
random numeric counter pingquin_06 Linux - Software 2 12-15-2006 11:18 PM
umask0000 what is the fourth digit for? cooljed Linux - Newbie 1 05-14-2006 01:45 PM
54 digit numbers Scratchit General 3 06-23-2004 09:24 AM
java, reversing digit Lifesaver Programming 5 03-03-2004 04:09 PM
How to define Text box as numeric Linh Programming 1 09-24-2003 03:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration