home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomeBook TitleSearch this book

A.4. dtksh

The Desk Top Korn Shell (dtksh) is a standard part of the Common Desktop Environment (CDE), available on commercial Unix systems such as Solaris, HP-UX, and AIX. It is based on a somewhat older version of ksh93. It evolved from the earlier program wksh, the Windowing Korn shell, released by Unix System Laboratories in late 1992. It's a full Korn shell, compatible with the version that this book describes,[149] that has extensions for graphical user interface (GUI) programming in the X Window System environment. It is typically found in /usr/dt/bin/dtksh.

[149] Features listed throughout the book as being introduced for "recent" versions won't be in dtksh.

dtksh supports the OSF/Motif graphical Toolkit by making its routines available as built-in commands. This allows programmers to combine the Korn shell's strength as a Unix systems programming environment with the power and abstraction of the Toolkit. The result is a unified environment for quick and easy development of graphics-based software.

There are various GUI development tools that allow you to construct user interfaces with a graphics-based editor rather than with programming language code. But such tools are typically huge, expensive, and complex. dtksh, on the other hand, is inexpensive and unbeatable for the smoothness of its integration with Unix -- it's the only such tool that you can use as your login shell! (Well, almost; see the next section.) It is a definite option for systems programmers who use X-based workstations and need a rapid prototyping tool.

To give you the flavor of dtksh code, here is a script that implements the canonical "Hello World" program by displaying a small box with an "OK" button. It is from the article Graphical Desktop Korn Shell, in the July, 1998 issue of Linux Journal, by George Kraft IV. (See http://www.linuxjournal.com/article.php?sid=2643.) This code should hold no surprises for X and Motif programmers:


XtInitialize TOPLEVEL dtHello DtHello "$@"

XmCreateMessageDialog HELLO $TOPLEVEL hello \
            dialogTitle:"DtHello" \
            messageString:"$(print "Hello\nWorld")"
XmMessageBoxGetChild HELP $HELLO \
XtUnmanageChild $HELP
XmMessageBoxGetChild CANCEL $HELLO \
XtUnmanageChild $CANCEL
XtAddCallback $HELLO okCallback exit
XtManageChild $HELLO

http://www.cactus.org/~gk4/kraft/george/papers/dtksh/ is Mr. Kraft's web presentation on dtksh.

The following book is devoted to dtksh: Desktop KornShell Graphical Programming by J. Stephen Pendergast, Jr., published by Addison-Wesley, 1995 (ISBN: 0-201-63375-2). Examples from the book are online at ftp://ftp.aw.com/aw.prof.comp.series/pendergrast.examples.tar.Z. Also available is ftp://ftp.aw.com/aw.prof.comp.series/pend.dtksh1, a text file that provides an overview of the book. Unfortunately, as of this writing, this book is out of print.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.