Graphical Desktop Korn Shell

Portability and pervasiveness are two important characteristics to consider when you are developing code. Using a programming language with a well-defined and stable application programming interface (API) answers the need for portability. A programming language with a large, established installed base provides pervasiveness. Although Perl, Tcl/Tk, Common Gateway Interface (CGI) and Java have large installed bases, they are not suited for some projects. The reason for this is their inconsistent installation base due to the lack of a well-defined or rapidly changing API.
The Desktop Korn Shell (DtKsh) that comes with the Common Desktop Environment (CDE) is built on the ksh93 standard with X, Xt, Motif, ToolTalk and CDE built-in APIs. Unlike Perl and Tcl/Tk, major vendors have built and supported DtKsh through the CDE initiative. Using DtKsh, desktop programmers can develop and/or prototype plug-and-play Graphical User Interface (GUI) applications that are compatible on all CDE-compliant systems without compilation. Although DtKsh applications are interpreted for portability, they can easily be migrated to Motif in C for performance.
Tcl/Tk can be ported to C with the aid of special Tcl/Tk libraries; however, programmers are as disadvantaged with the C Tcl/Tk libraries as they are with the Tcl/Tk shell, because of a not-so-standard application programming interface. DtKsh, unlike Tcl/Tk, provides a well-established API set where the programmer's knowledge transcends from C to shell programming.
In AIX, /bin/ksh is an XPG4-compliant version of ksh88. CDE's /usr/dt/bin/dtksh on AIX is based on the newer ksh93 standard. ksh93 now includes floating-point mathematics, associative arrays, new string operations, hierarchical variables, reference variables, developer-extendable APIs using attached shared libraries and character class patterns.
Floating-point mathematics: Korn Shell variables can be cast, or defined, to various aggregate data types. Floating-point mathematics is a new feature in the Korn Shell that enables the assignment and operation of decimal values. The following example defines the floating-point variable PI, then assigns to it the decimal value of 3.14159.
typeset -F PI # define "PI" as a float PI = 3.14159
Associative arrays: Instead of using positive integer indices, associative arrays allow elements of an array to be addressed using alphanumeric strings. The following example shows SYSINFO as an array containing information about an operating system. The associative SYSINFO array can be indexed with the alphanumeric string of "os" to find the string value of AIX.
typeset -A SYSINFO # define "SYSINFO" as an # associative array SYSINFO["os"]=AIXNew string operations: Six new string operations were introduced in ksh93. These new operations provide substringing and substitution of a string pattern with an alternate. Substringing permits extraction of a smaller string, given an offset indicating where to begin and possibly its length.
A substring of a larger string can be extracted by length at a given starting point, or a substring can be taken by starting at the offset within the larger string and stopping at the end of the string. The following shows a substring of a given length:
${variable:offset:length}A substring of no particular length can be taken by just providing the offset.
${variable:offset}String substitution of a character pattern can be performed for the first occurrence, a repeated occurrence, at the beginning of the string (prefix) or at the end of the string (suffix).Substitute the first occurrence of a pattern with an alternate string:
${variable/pattern/string}Substitute all occurrences of a pattern with an alternate string:
${variable//pattern/string}Substitute the pattern prefix with the alternate string:
${variable/#pattern/string}Substitute the pattern suffix with the alternate string:
${variable/%pattern/string}
BOX= # declare before assigning sub-members BOX.WIDTH = 80 BOX.HEIGHT = 24Reference variables: Referencing allows a variable to point to the same value as another variable; both variables reference the same value as shown below:
# name reference
typeset -n FOO=BAR
FOO="Hello World"
# print "Hello World"
print ${BAR}
Desktop built-in commands: Korn
Shell provides some standard X, Xt, Motif, POSIX
internationalization and CDE C language APIs directly built into
the shell. Direct access to these APIs from the shell provides a
significant runtime performance improvement for DtKsh shell
applications. Using the standard X and Motif APIs, with some
semantic changes to the source, makes it possible for DtKsh shell
scripts to be migrated to C and compiled.
POSIX internationalization: Korn Shell provides the shell equivalent of the C language POSIX internationalization APIs catopen and catgets. The internationalization APIs allow the shell program to change its message catalog depending on its language. Internationalized shell scripts enable multilingual support.
Character class patterns: Regular expressions in the shell are enhanced by predefining a set of character class patterns. Now we can easily match certain classes of characters by using the [[:class:]] notation where class can be specified as alnu, alpha, cntrl, digit, graph, lower, upper, print, punct, space and xdigit.
# only print files that # begin in upper case print [[:upper:]]* # old way print [A-Z]*
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Developer Poll
- What's the tweeting protocol?
- Dart: a New Web Programming Experience
- Readers' Choice Awards
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




1 hour 41 min ago
1 hour 58 min ago
2 hours 28 min ago
2 hours 29 min ago
2 hours 30 min ago
5 hours 30 min ago
13 hours 56 min ago
14 hours 2 min ago
14 hours 32 min ago
17 hours 46 min ago