Category:Jot: Difference between revisions

From Rosetta Code
Content added Content deleted
(This "library" is a shell command, BSD jot(1).)
 
m (Change from <tt> to <code>.)
 
Line 1: Line 1:
{{library}}
{{library}}
<tt>jot(1)</tt> is a shell command from [[BSD]] that can print a list of numbers. <tt>jot(1)</tt> is convenient when a [[UNIX Shell]] program needs to iterate a range of numbers. Examples that use <tt>jot(1)</tt> will not work with other Unix systems that are missing <tt>jot(1)</tt>.
<code>jot(1)</code> is a shell command from [[BSD]] that can print a list of numbers. <code>jot(1)</code> is convenient when a [[UNIX Shell]] program needs to iterate a range of numbers. Examples that use <code>jot(1)</code> will not work with other Unix systems that are missing <code>jot(1)</code>.


<lang bash># Example: this loop echoes Got 1, Got 2, Got 3.
<lang bash># Example: this loop echoes Got 1, Got 2, Got 3.
Line 7: Line 7:
done</lang>
done</lang>


The syntax is <tt>jot count begin end step</tt>
The syntax is <code>jot count begin end step</code>


All four arguments are optional. A hyphen <tt>-</tt> skips an argument. Here are some examples.
All four arguments are optional. A hyphen <code>-</code> skips an argument. Here are some examples.


* <tt>jot 5</tt> prints 1 2 3 4 5.
* <code>jot 5</code> prints 1 2 3 4 5.
* <tt>jot 5 10 20</tt> prints 10 12 15 18 20.
* <code>jot 5 10 20</code> prints 10 12 15 18 20.
* <tt>jot -p 2 5 10 20</tt> prints 10.00 12.50 15.00 17.50 20.00.
* <code>jot -p 2 5 10 20</code> prints 10.00 12.50 15.00 17.50 20.00.
* <tt>jot - 3 7 1</tt> prints 3 4 5 6 7.
* <code>jot - 3 7 1</code> prints 3 4 5 6 7.
* <tt>jot - 7 3 -1</tt> prints 7 6 5 4 3.
* <code>jot - 7 3 -1</code> prints 7 6 5 4 3.


It has a few other features, like random numbers. For a manual page, see [http://www.openbsd.org/cgi-bin/man.cgi?query=jot&apropos=0&sektion=1&manpath=OpenBSD+Current&arch=i386&format=html jot(1)].
It has a few other features, like random numbers. For a manual page, see [http://www.openbsd.org/cgi-bin/man.cgi?query=jot&apropos=0&sektion=1&manpath=OpenBSD+Current&arch=i386&format=html jot(1)].

Latest revision as of 02:11, 28 July 2011

Library
This is an example of a library. You may see a list of other libraries used on Rosetta Code at Category:Solutions by Library.

jot(1) is a shell command from BSD that can print a list of numbers. jot(1) is convenient when a UNIX Shell program needs to iterate a range of numbers. Examples that use jot(1) will not work with other Unix systems that are missing jot(1).

<lang bash># Example: this loop echoes Got 1, Got 2, Got 3. for i in `jot 3`; do echo Got $i done</lang>

The syntax is jot count begin end step

All four arguments are optional. A hyphen - skips an argument. Here are some examples.

  • jot 5 prints 1 2 3 4 5.
  • jot 5 10 20 prints 10 12 15 18 20.
  • jot -p 2 5 10 20 prints 10.00 12.50 15.00 17.50 20.00.
  • jot - 3 7 1 prints 3 4 5 6 7.
  • jot - 7 3 -1 prints 7 6 5 4 3.

It has a few other features, like random numbers. For a manual page, see jot(1).

Pages in category "Jot"

The following 6 pages are in this category, out of 6 total.