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
This blog entry continues an earlier discussion of ksh93 custom builtins and includes a number of more advanced examples. First of all, the development of custom builtins is easier when the libast header <shell.h> is included. It ensures that other necessary AST headers are included so that C prototypes are provided and calls to stdio routines are re-mapped to use the equivalent but safer sfio (AST Safe Fast Input Output) routines. The maintainers of ksh93 (David Korn and Glen Fowler) regard the standard stdio routines as having too many weaknesses to be used safely by ksh93. Another useful feature is
TCL (Tool Command Language, typically pronounced as “tickle”) is a scripting language created by John Ousterhout in 1988 while working at the University of California, Berkeley. To provide additional functionality, TCL supports extensions. One of the most popular extensions is Expect which is a tool developed by Don Libes for automating and testing interactive applications such as ftp. telnet and ssh. I assume you know how to generate SSH keys using ssh-keygen and understand that if you want to be able to ssh to a remote system without entering a password you need to create the keys without a passphrase.