Using SCODB on SCO OpenServer 5

Command aliasing

Use the alias and unalias commands to display or set up and unset aliases:

   alias [word [new command...]]                   /* Set or list aliases */
   unalias [*|aliases...]                          /* Unset alias */
Aliases allow the user to customize the SCODB environment by making the use of commonly used complex commands simpler. When SCODB is given a command by the user, it checks the command against the list of aliases. If the command matches the word of an alias, substitution is performed. When performing alias substitution of simple aliases (those without argument substitution), the first word of the user's command is substituted by the entire alias, with the arguments to the user's command appended to the end. Aliases may reference other aliases, as long as no loop results. Loops are detected by restricting the number of alias substitutions per command.

unalias is used to unset aliases. Given an argument of ``*'', unalias clears all aliases; otherwise it clears only those listed.

alias used with no arguments lists the currently set aliases. Given one argument, alias lists the alias for that word. An example of a simple alias:

   debug0:1> alias dbp bp wl
   debug0:2> alias
   dbp               bp wl
   debug0:3> dbp &u.u_error
   debug0:4> alias dbpe dbp &u.u_error
   debug0:5> alias
   dbpe              dbp &u.u_error
   dbp               bp wl
   debug0:6> dbpe
More complex aliases can be made that will perform argument substitution by replacing part of the alias with a given argument to that alias. Argument substitution is done when a ``!'' is found inside an alias:

0-9 argument number
^ first argument (same as !1)
$ last argument
* all arguments (^ through $, inclusive)

The character following determines which argument is substituted. When resolving complex aliases, the command arguments are used only in argument substitution, and are not appended to the resultant command:

   debug0:7> unalias *
   Clear all aliases? Yes
   debug0:8> alias dbp bp wl &!1
All alias information is lost when the machine reboots. To configure aliases to be present automatically in SCODB, modify the alias table in the SCODB space.c file (/etc/conf/pack.d/scodb/space.c).

As released, the alias table is empty:

   struct alias dbalias[NDBALIAS];
To add, for example, the following alias:
   debug0:11> alias dbp bp wl &!1
Modify the table to:
   struct alias dbalias[NDBALIAS] = {
           { "dbp", "bp wl &!1" },
SCODB does not necessarily detect errors in such a configured table, so exercise caution when modifying the configuration. Note that the NDBALIAS constant is a tunable parameter and should not be modified inside the space.c file.
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005