HP 3000 Manuals

Introducing the MPE/iX Shell and Utilities [ COMMUNICATOR 3000 MPE/iX General Release 5.0 (Core Software Release C.50.00) ] MPE/iX Communicators


COMMUNICATOR 3000 MPE/iX General Release 5.0 (Core Software Release C.50.00)

Introducing the MPE/iX Shell and Utilities 

by Daren Connor 
Commercial Systems Division 

Overview 

A new product called the MPE/iX Shell and Utilities is now available and
is included as part of the Fundamental Operating System (FOS). This new
product is a command interpreter with an integrated collection of over
100 utilities and commands that comply with the POSIX (Portable Operating
System Interface) standard.  Also included are several tools that are not
part of the POSIX standard, which facilitate use of the product on MPE/iX
in particular.  This product provides an environment that encourages both
productivity and portability and is particularly useful for development
of open applications using the MPE/iX Developers' Kit (36430A).

The MPE/iX shell is similar to, and is based upon, the UNIX Korn shell, a
powerful, widely used environment in the UNIX community.  Like any
command interpreter (such as CI.PUB.SYS), the MPE/iX shell interactively
interprets and responds to a user's command line.  The shell can also be
used as a programming language.  That is, it allows you to put commands
into a file and then execute that file as a program.  These are known as
shell scripts and are used extensively by UNIX system users.

Tools Provided 

Here are some of the tools included in the MPE/iX Shell and Utilities:

awk - A powerful facility that can perform many different operations on
files based on specified selection and reporting options.  For example,
to display every record in the file "file" that contains the string
"abc", you would execute the following from within the MPE/iX Shell:

           awk '/abc/ {print}' file 

lex/yacc - Tools to create lexical analyzers and parsers.  These are
often used for compiler and user interface construction.

make - A utility to help manage a collection of interdependent files,
typically for a program built from several separate object modules, each
of which depends on its own source file.  It allows specification of
dependencies between files and automatically updates those which are now
out of date compared to their dependent files.

rcs - Simplifies the task of keeping track of changes to files over a
period of time.  It facilitates creating multiple versions of the same
file, locking of particular versions, and many other operations.

vi - The standard UNIX text file editor.

ls, cp, mv - Typical file manipulation commands to list, copy, and rename
files.

ps - A utility to show process information for the system.  This command
gives an administrator information about activity on the system as well
as providing necessary parameters for other commands.

For a complete list of commands and utilities, refer to the MPE/iX Shell 
and Utilities Reference Manual (Volumes 1 and 2) (36431-60001).

The MPE/iX shell provides an integrated environment for the various tools
to work together in a more productive manner.  One example of this is the
ability to couple the output of one tool to another conveniently through
the use of the pipe facility built into the shell.  For example, the
following demonstrates coupling two tools together, wc and grep, to find
all files that are 50 lines long:

          wc -l * | grep 50 

Comparing MPE/iX CI Commands to the MPE/iX Shell 

Here is a list of several MPE/iX CI commands and the corresponding
logical equivalent within the shell:

     MPE/iX CI Command/Feature     MPE/iX Shell Equivalent
     -------------------------     -----------------------
     NEWDIR                        mkdir
     CHDIR                         cd
     SHOWTIME                      date
     LISTREDO                      history
     LISTFILE                      ls
     SHOWPROC                      ps
     HELP                          man
     PRINT                         more
     COPY                          cp
     RENAME                        mv
     PURGE                         rm -i
     UDCs, Command Files           Shell functions,

For the sake of comparison, here is the output of LISTFILE within the CI
and ls within the MPE/iX shell:
________________________________________________________________________________
|                                                                              |
|                                                                              |
|      CI.PUB.SYS:                                                             |
|      -----------                                                             |
|                                                                              |
|      :listfile a@,2                                                          |
|      ACCOUNT=  SYS         GROUP=  PUB                                       |
|                                                                              |
|      FILENAME  CODE  ------------LOGICAL RECORD-----------  ----SPACE----    |
|                        SIZE  TYP        EOF      LIMIT R/B  SECTORS #X MX    |
|      ACCTJOBS           32B  FA           1          1   1       16  1  1    |
|      ADVWCATL  MGCAT   128W  FB          23         23   1       32  1  1    |
|      ADVWCONV  PROG    128W  FB        1124       1124   1     1136  1  1    |
|                                                                              |
|                                                                              |
|      MPE/iX Shell:                                                           |
|      -------------                                                           |
|                                                                              |
|      shell/iX> ls -l A*                                                      |
|      -rwxr-xr-x   1 MANAGER.SYS       SYS           32 Sep  8 17:18 ACCTJOBS |
|      -rwxr-xr-x   1 MANAGER.SYS       SYS         5888 Sep  8 17:37 ADVWCATL |
|      -rwxr-xr-x   1 MANAGER.SYS       SYS       288000 Sep  8 17:44 ADVWCONV |
|                                                                              |
________________________________________________________________________________

            

Archiving 

The archive utilities tar, cpio and pax can be used in the POSIX.2 shell
to copy and back up files.  This provides a simple way for MPE/iX users
to exchange files with other open systems that support these tape
formats.

Before these utilities can access a tape drive, a device link file to
that tape device must be created.  This is done with the MKNOD utility,
which can be run from either the MPE/iX Command Interpreter or the
POSIX.2 shell.  To create the default device file "/dev/tape" used by
tar, enter:

       :MKNOD "/dev/tape c 0 7" 

Where /dev/tape is the device link file name, and 7 is the LDEV that the
device link file is linked to.  The two parameters "c" (lowercase) and 0
(zero) are required to create a device link file.  Quotes are required
around all the parameters for the CI to pass them as part of the "INFO="
string to the MKNOD program.

To see what you created, use :LISTFILE, 7 (UNIQUE):

       :LISTFILE /dev/tape,7 

       FILE: /dev/tape

       DEV TYPE  : DEVICE LINK
       LDEV      : 7                   IO CLASS  : TAPE

To create the same device link from the shell, enter:

       shell/iX> mknod /dev/tape c 0 7 

For more information on device links, refer to the article, "Enhancements
to Support Special and Device Files", in this Communicator.

After you have created this default device link file, you can use tar:

       shell/iX> tar -xv 

Here the options -xv tell tar to extract all files from the default
device, displaying each filename as it is extracted.

Built-Ins 

To enhance shell performance, many of the most commonly used commands are
built into the operating system.  This means that the shell uses
procedure calls to implement commands which have historically been
implemented as process creations.  In addition, the new UID/GID database
design has dramatically enhanced the performance of the ls command as
compared to the restricted 4.5 release.  The real benefit of this change
is that non-interactive shell invocations and the ls command in
particular is noticeably faster.

The built-in commands include:  callci, cat, chmod, chown, cp, ls, mv,
and printf.

HPPXUDC.PUB.SYS 

MPE/iX Release 5.0 includes a file containing simple UDCs that are
designed to make the transition to the various POSIX features supported
on MPE easier.  If you have catalogued this file, you may use the UDC
"sh" to invoke the shell with the proper options and environment.  The
UDC file is called HPPXUDC.PUB.SYS.

Additional Information 

This product comes with both a two-volume reference manual and a user's
guide.  If you are already familiar with the KORN shell and the UNIX way
of doing things (for example, hierarchical directories), you can probably
start to use the MPE/iX Shell and Utilities software immediately after
installation and just refer to the MPE/iX Shell and Utilities Reference 
(Volumes 1 & 2) (36431-60001) as necessary (you may want to read
carefully the section titled "MPE/iX Implementation Considerations").
The MPE/iX Shell and Utilities User's Guide (36431-90002) introduces you
to the various components of the product through a series of tutorials
and guides, without an excessive amount of detail for a new user.  The
documentation is very thorough and of great value in making use of the
shell.



MPE/iX Communicators