Top «Prev(2007-11-18) Latest Next(2008-01-16)» Edit

pterjan's diary


  Letter sequence in bash

Someone asked on IRC how to generate a sequence of letters in bash, like seq does for numbers.

An answer was to use jot -w %c 26 a on FreeBSD, but he was on Linux.

I gave an other answer for use with bash 3, and I post it here as it looks like not much people know it :

[pterjan@plop ~]$ echo {a..e}
a b c d e
[pterjan@plop ~]$ echo {a..b}{a..b}
aa ab ba bb

Today's TSUKKOMI(Total: 2) [Add a TSUKKOMI]
  Bapt (2007-12-06 12:33)

In zsh : <br>-=[bapt@wicklow]=(~)> print {a-n} <br>a b c d e f g h i j k l m n<br><br>or <br>-=[bapt@wicklow]=(~)> print {a-n}{a-n}<br>aa ab ac ad ae af ag ah ai aj ak al am an ba bb bc bd be bf bg bh bi bj bk bl bm bn ca cb cc cd ce cf cg ch ci cj ck cl cm cn da db dc dd de df dg dh di dj dk dl dm dn ea eb ec ed ee ef eg eh ei ej ek el em en fa fb fc fd fe ff fg fh fi fj fk fl fm fn ga gb gc gd ge gf gg gh gi gj gk gl gm gn ha hb hc hd he hf hg hh hi hj hk hl hm hn ia ib ic id ie if ig ih ii ij ik il im in ja jb jc jd je jf jg jh ji jj jk jl jm jn ka kb kc kd ke kf kg kh ki kj kk kl km kn la lb lc ld le lf lg lh li lj lk ll lm ln ma mb mc md me mf mg mh mi mj mk ml mm mn na nb nc nd ne nf ng nh ni nj nk nl nm nn

  dalfa (2007-12-06 13:54)