.Dd July 13, 2004 .Dt COUNT 1 .Os NetBSD 1.4T .Sh NAME .Nm count .Nd counting utility .Sh SYNOPSIS .Nm .\" What I want is... .\" .Op Ar keyword Ar value Op Ar keyword Ar value ... .\" but that runs into a number-of-arguments limit, and using .Xo/.Xc .\" doesn't work with .Op. So.... .Bo .Ar keyword .Ar value .Op Ar keyword Ar value ... .Bc .Sh DESCRIPTION .Nm counts. The keyword-value pairs allow specifying many aspects of the counting operation; the allowed keywords are: .br .Bl -tag -width "postfix" -compact -offset indent .It from The number to start counting at. .It to The number to stop counting at. .It by The increment between numbers. .It pad The width to pad the numbers to (pad with spaces). .It 0pad The width to pad the numbers to (pad with zeroes). .It base The base to count in. .It prefix A string to print before the numbers. .It postfix A string to print after the numbers. .It delay How long, in seconds, to pause between each value and the next. (May be a float.) .El .br All of these have defaults. The defaults are usually sensible; specifically, the following rules are used to supply any missing values: .Bl -bullet -offset indent .It If no .Ar start value was given, then if either .Ar by or .Ar to was given with a negative value, then the starting value is \-1, otherwise it's 1. .It If no .Ar by value was given, then if a .Ar to value was given and its value is less than the (possibly defaulted) starting value, the increment is \-1, otherwise it's 1. .It If no padding .Pf ( Ar pad or .Ar 0pad ) was specified, no padding is provided; the effect is as if .Sq "pad\ 1" were specified. .It If no .Ar prefix is specified, a zero-length string is used as the prefix. .It If no .Ar postfix is specified, a single newline is used as the postfix. (Note that specifying a .Ar postfix overrides this default; if you want a newline, you must specify it.) .It If no .Ar base is specified, the default is 10. .It If no .Ar delay is given, no pause is done. .El Any numeric .Ar value Ns s may be given in binary, octal, decimal, or hex. If the first two characters of the number are 0b or 0B, the number is in binary; if 0o or 0O, the number is in octal; if 0t or 0T, decimal; if 0x or 0X, hex. Otherwise, the number is in decimal, unless it has a leading 0, which indicates octal. (This does not apply to .Ar delay , even though it is in a sense numeric.) .Pp String values are examined for \e escapes. If the character following the \e is one of abefnrt, the two-character sequence is replaced with a bell, a backspace, an escape, a form-feed, a newline, a carriage-return, or a tab, respectively. If the following character is an octal digit, then a string of up to three following octal digits is taken to specify a character code. If the following character is an x or X, a string of hex digits of unlimited length is taken to specify a character code. If the following character is a \&-, both the \e and the \&- are dropped. Otherwise, the \e is removed and the following character is retained. .Pp If the .Ar start and .Ar to values are equal, only one number is printed. .Pp If the .Ar by value is zero, the result is an infinite loop, unless the previous paragraph applies. .Pp There are probably bugs lurking around the use of the most negative integer on two's-complement architectures; it's best to avoid it. .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .