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]*
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
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
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| 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 |
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- RSS Feeds
- Validate an E-Mail Address with PHP, the Right Way
- Readers' Choice Awards
- Tech Tip: Really Simple HTTP Server with Python
Enter to Win an Adafruit Pi Cobbler Breakout 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 Pi Cobbler Breakout 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
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




34 min 8 sec ago
1 hour 6 min ago
3 hours 30 min ago
3 hours 33 min ago
3 hours 34 min ago
7 hours 59 min ago
9 hours 50 min ago
15 hours 3 min ago
18 hours 15 min ago
20 hours 30 min ago