DSPMSG(1,C) AIX Commands Reference DSPMSG(1,C)
-------------------------------------------------------------------------------
dspmsg
PURPOSE
Displays a message from a message catalog or a default message if the specified
message cannot be accessed.
SYNTAX
+-----------------+
dspmsg ---| |--- catfile --- msg-number --->
+- -s set-number -+
+-----------------------------------+
>---| +-----------+ |---|
+- 'default message' -| |-+
+--- arg ---+
^ |
+-------+
DESCRIPTION
Use the dspmsg command in shell scripts to display messages from a message
catalog to the person running the shell script program. It is an alternate to
the message presenting capability of the echo command. The separate dspcat
command (page dspcat-1) can display more than one message at a time, and is
usually used from the command line.
The dspmsg command first searches the directory
/usr/lib/mbcs/msg/language.codeset/ for catfile. The language.codeset depends
on the current locale. (The locale may be changed using the LANG environment
variable.) For example, if the current locale is English, the default search
directory would be /usr/lib/mbcs/msg/En.pc850/. If catfile is not found in the
default search directory, dspmsg searches the current directory for catfile.
The catfile parameter specifies the catalog being accessed. The -s set-number
parameter specifies a specific set within the message catalog. The default
value for the set to be accessed is 1. The msg-number parameter specifies the
message to be displayed from the catalog. If the message specified by the
preceding parameters cannot be displayed, a default message, if supplied, is
displayed.
The arg parameter specifies arguments that can be substituted into the message.
Up to 10 arguments can be substituted. The specified arg parameters are
inserted in place of the "%" characters within the message extracted from the
catalog. Positional parameters are also supported (for information on
positional parameters, see the printf subroutine in the AIX Technical
Processed November 8, 1990 DSPMSG(1,C) 1
DSPMSG(1,C) AIX Commands Reference DSPMSG(1,C)
Reference). The only allowable substitution is a string value; a non-string
variable produces undefined results. The arg parameter can be included only
when a default message is also included.
Note: Message catalog files are binary files which must be created by the
gencat command.
EXAMPLE
The following sh shell script fragment will display message 1 from set 2 in
"/u1/stevea/errors.cat" if no parameters are supplied to the shell script. If
message 1 from set 2 doesn't exist in "errors.cat", the message in quotes will
be displayed.
if [ $# -eq 0 ]
then
dspmsg =s 2 /ul/stevea/errors.cat 1 "Input invalid. Please try again."
fi
RELATED INFORMATION
See the following commands: "echo," "dspcat," and "gencat."
See the catopen subroutine in the AIX Technical Reference.
See the "Message Catalog Generation" section of the "International Character
Support" chapter of the AIX Operating System Programming Tools and Interfaces.
See the "Messages" chapter in the AIX MBCS Guide.
Processed November 8, 1990 DSPMSG(1,C) 2