Image of Operating System Concepts
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Modern Operating Systems (3rd Edition)
Image of Android Wireless Application Development

The Time Keyword in Bash

The word time is one of the bash shell reserved words. It is not a bash shell builtin. $ builtin time bash: builtin: time: not a shell builtin Bash does support the older Bourne shell keyword times as a builtin. This builtin prints out the user and system times used by the shell and its children. So where is the time reserved word used in the bash shell? It is primarily intended for printing pipeline timing statistics. From the current online bash documentation: The format for a pipeline is [time [-p]] [!] command1 [| command2 …] The output of each

Bash Hash Builtin

The Bash shell hash builtin maintains a hash cache (table) containing the full pathname of previously executed commands that are on your PATH environmental variable. If the command is in the hash table, it just executes it without searching for it in the various path components. SYNTAX hash [-r] [-p filename] [name] OPTIONS -r Reset (causes the shell to forget all remembered locations) -p Use filename as the location of name (don’t search $PATH) If no arguments are given, information about remembered commands is printed. The return status is zero unless a name is not found or an invalid option

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

Korn Shell 93 Alarm Builtin

Sometimes it is useful to have part of a shell script run periodically, e.g. once a millisecond or every 10 minutes.  Although this is possible by starting a process in the background, ksh93 has an easier (but undocumented) feature which allow a script writer to set up interval timers. This undocumented feature is a built-in called alarm and a corresponding discipline also called alarm. I am not going to attempt to explain what a discipline or a compound variable is in this post as I assume that you have read the ksh93 man page.  If you list your built-ins using the builtin