« Firefox 3.5 Regression issues with wildcard SSL certificates | Main | Upgraded Movable Type »

jot gotcha

Seeing that I run into this jot gotcha every couple of months while writing shell scripts, I thought I would add a reminder for myself here (and so that google can pick this up for me next time).

On FreeBSD, by default you don't get access to the seq command to generate sequences, so you naturally will use jot for your shell scripting needs for generating number sequences.

So for example, we want to start with 0 and increment to 4 (one cannot use variables in the bash sequence generator, so {0..$max} won't work here. So for example we have 5 logfiles that we want to grok on a server and another has 6 so instead of hardcoding the varible on each server like {0..4} where we have 4, {0..6} where we have 6, we use jot and some nasty piping commands to get that number.

root# jot 4     
1
2
3
4

Okay so misread the manual very quickly and try:

root# jot 0 4
4
5
6
7
8
9
10
*snip*
93211
93212
93213
93214

Pass the number of iterations (5), start (0) and where it ends (4):

root# jot 5 0 4
0
1
2
3
4


TrackBack

TrackBack URL for this entry:
http://www.powertrip.co.za/blog/mt-tb.cgi/618

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Afrigator