Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of Android Wireless Application Development
Image of Operating System Concepts
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

Scripting HAL

Recent releases of Fedora and other GNU/Linux distributions include a Hardware Abstraction Layer (HAL) which is used to support device plug-and-play capabilities.  In this post I will show you how your shell scripts can use HAL to retrieve device and system information. The term HAL is overloaded as it used to refer both to a specification and the actual software which implements the specification.  From an application developers viewpoint, HAL is way to enumerate the capabilities and features of hardware attached to a system and receive notification when something about the hardware changes. First, a very quick overview of HAL. 

KSH93 Extended Patterns

According to David Korn, a shell is primarily a string processing language. Pattern matching is an important compoment of any such language and indeed Korn Shell 93 (ksh93) has excellent support for extended patterns as well as regular expressions. Extended patterns can be thought of as class or type of extended regular expressions. Both the bash and zsh shells have something similar but not as comprehensive. However, as usual, extended patterns are documented quite tersely in the ksh93 man page. The purpose of this post is to explain, with some examples, how to use the power of extended patterns in

JavaScript E4X

In previous posts, I discussed the SpiderMonkey command line shell js and how to add support to it to enable full access (read, write, create, copy, delete, etc.) to the local filesystem via the File object and the NSPR library. While rumaging around in the source code and documentation for js, I found that js partially supported the EX4 XML extension via a user configurable option. This post looks at what it takes to load an XML document into js from your local filesystem, process it and write out the resulting document to your local filesystem using File objects and

JavaScript File Object

As you are probably aware JavaScript engines such as SpiderMonkey typically do not allow access to the local filesystem for reasons of security.  To enable developers to test the scripts from a command line, js includes the load() function which enables you to load one or more JavaScript scripts into the SpiderMonkey engine.  However this is not sufficient for our purposes as no means is provided to write to the filesystem.  Looking more closely at the source code, I noticed support for File objects.  This support is not enabled by default however.  It is not sufficient to simply recompile SpiderMonkey

Korn Shell 93 Stat Builtin

One of the builtin commands that is missing in ksh93, in my humble opinion, is a builtin similar to stat(1) which would return information about a file. Here is my initial implementation of a stat builtin. The output is a compound variable whose subvariables contain the contents of the various fields of the stat(2) structure. If you are unfamiliar with compound variables, see my previous post for an eluridation. /* ** FPMurphy 2009-01-03 ** ** License: Common Public License Version 1.0 ** */ #pragma prototyped #include “defs.h” #include “builtins.h” #include “path.h” #include <tm.h> /* macro to create subvariables */ #define