Introducing the MPE/iX Shell and Utilities [ COMMUNICATOR 3000 MPE/iX Release 5.0 (Core Software Release X.50.20) ] MPE/iX Communicators
COMMUNICATOR 3000 MPE/iX Release 5.0 (Core Software Release X.50.20)
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, grep and wc, to
determine the number of lines containing the string "foo" in the file
"file":
grep foo file | wc
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
Spooling/Archiving
With the existence of device link files, and some work by the system
administrator to make the appropriate device links, the shell has access
to devices such as tape drives and printers.
A device link is a special file created with the mknod() interface which
creates a permanent association between a filename and a device's LDEV.
Essentially, the device link is like a permanent, named FILE command
which simply associates a name with an LDEV.
The power of device links is that they allow the shell to access any
device without having to understand MPE access semantics. The only
drawback is that none of the shell interfaces allow for modification of
MPE default characteristics.
Overall, the main advantage is that files can be printed on all printers
and that tar, cpio, and pax can talk directly to tape drives.
Please refer to the article "Enhancements to Support Special and Device
Files" in this Communicator for further information.
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