DtkshDemos
is a miscellaneous collection of freeware demos written in the
Desktop Korn Shell, dtksh.
dtksh is an X11 enabled version of the new Korn shell (ksh93).
It is a handy language for the occasional simple GUI.
Unfortunately it seems that very few people use it, and so very few sample
scripts can be found on the Internet (I found less than a dozen unique
scripts). I hope this small collection helps.
Warning: Currently these are "demos" not "tools". dtksh does not appear well maintained across different OSes, so often these scripts will run for a minute and then freeze. If dtksh were to be fixed at some point in the future, this website may be renamed "dtkshtools".
Note: The code is based on the dtksh and X11 man pages, I has seen very little code that actually used XmDrawingArea for plotting. You may find some official examples in a path such as /usr/dt/share/examples/dtksh - depending on your OS.
Contents and Downloads
Operating Systems
These programs require dtksh. They has been tested on Solaris, but they will probably work fine on HPUX, AIX and wherever else dtksh is available.
Screenshots
xvmstat
- is a tool to plot the output of vmstat.
Configurables include size and colour.
$ ./xvmstat -x 400 -y 450 |
xplot
- is a tool to plot a list of numbers read from
STDIN. The idea was that whenever you are looking at a column of numbers
(perhaps the output of a command or the contents of some log file), xplot
could be used to graph them.
Configurables include field, delimiter, size and colour.
In this example we run vmstat with a one second interval, then
pipe this into xplot and take the 21st field "-f 20" and plot it.
The maximum is 100 "-hi 100", and a title is set using "-t sys",
$ vmstat 1 kthr memory page disk faults cpu r b w swap free re mf pi po fr de sr dd dd f0 s3 in sy cs us sy id 0 0 0 585144 88384 1 7 3 0 0 0 0 0 0 0 0 421 853 242 2 1 98 0 0 0 539800 50024 0 7 0 0 0 0 0 0 4 0 0 459 990 318 3 0 97 0 0 0 539800 50024 1 0 0 0 0 0 0 0 0 0 0 667 1334 459 1 3 96 ^C $ $ vmstat 1 | xplot -f 20 -hi 100 -t sys |
In this example we run netstat -i 1 to watch inbound packets. The first
field is then plotted using xplot "-f 0" with a line colour of green
"-lc Green" and an x increment per point of 5 "-inc 5",
$ netstat -i 1
input hme0 output input (Total) output
packets errs packets errs colls packets errs packets errs colls
2577891 0 3127581 0 0 4302512 0 4852202 0 0
106 0 74 0 0 112 0 80 0 0
85 0 58 0 0 91 0 64 0 0
64 0 44 0 0 70 0 50 0 0
^C
$
$ netstat -i 1 | tail +4 | xplot -f 0 -inc 5
|
xworldclock
- is a tool to print times from around
the world. Configurables include size and colour.
$ ./xworldclock |
xpong
- is a demo of a game in dtksh. 1 or 2 player.
(I wrote this to see how well it would perform)...
$ ./xpong |
xlinesdemo
- is a simple demo of the X11 capabilities.
A good place to start if you are learning dtksh.
$ ./xlinesdemo |