Translate

Image of Linux Kernel Development (3rd Edition)
Image of Operating System Concepts
Image of Beginning Google Maps API 3
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

Using Types To Create Object Orientated Korn Shell 93 Scripts

Most experienced software developers are familiar with the fact the Python, Perl, Ruby, JavaScript and other scripting languages support object orientated programming (OO) concepts such as classes and inheritance. However these same software developers would probably be extremely surprised to learn that the latest version of the Korn shell (Version 93 t+) also supports the object orientated paradigm. The OO paradigm is implemented in ksh93 by means of user-defined types. A type can be defined either by a shared library, by means of the new typeset -T declaration command, or by means of the enum declaration command. The method for

Sort Korn Shell 93 Associative Arrays

Both ksh93 and bash V4 support associative arrays. However neither provide any built-in mechanism to sort associative arrays. Recently I came across the following problem. Given a list of IP addresses such as the following: 192.168.1.10 192.168.1.10 192.168.1.10 192.168.1.11 192.168.1.15 192.168.1.15 192.168.1.20 192.168.1.22 how can one produce a group by summary report similar to the following: 192.168.1.10 : 3 192.168.1.15 : 2 192.168.1.20 : 1 192.168.1.11 : 1 192.168.1.22 : 1 The report counts the occurrences of each IP address in the input list, and outputs the count in descending order. Note it does not try to sort the IP

Hard Disk Metadata

Recently I was asked how to programmatically retrieve the serial number of a hard disk using C++ on a GNU/Linux platform. After a small amount of research, I wrote a short demonstration program and that was that or so I thought. However my curiosity was picqued and I decided to look at how to extract other metadata from a hard disk. To satisfy this curiosity I wrote a small utility that outputs selected metadata from hard disk in a number of formats, i.e. XML, TEXT and CSV (Comma Separated Values). Here is example of the output in TEXT mode: #