[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 2

dspmsg Command

Purpose

Displays a selected message from a message catalog.

Syntax

dspmsg [-s SetNumber ] CatalogName MessageNumber [ 'DefaultMessage' [ Arguments ] ]

Description

The dspmsg command displays either the text of a particular message from a message catalog generated with the gencat command or, if the message cannot be retrieved, a default message supplied as a parameter to the command. The dspmsg command directs the message to standard output. This command is intended for use in shell scripts as a replacement for the echo command.

The NLSPATH environment variable and the LC_MESSAGES category are used to find the specified message catalog if no / (slash) characters are used in the value of the CatalogName parameter. If the catalog named by the CatalogName parameter is not found or if the message named by the MessageNumber parameter (and optional SetNumber value) is not found, then the supplied DefaultMessage value is displayed. If a DefaultMessage value is not specified, a system-generated error message is displayed.

The dspmsg command allows up to ten string arguments to be substituted into the message if it contains the %s, %n$s, %ld, or %n$ld printf subroutine conversion specification. Missing arguments for conversion specifications result in a dspmsg error message. Normal printf subroutine control character escapes (for example, \n) are recognized.

The use of printf subroutine format strings is recommended in the catalog. This format provides for correct insertion of arguments even if the format strings in the message are in a different order than the default message. You must enclose the default message in single quotation marks if using the %n$s notation for message inserts.

Flags

-s SetNumber Specifies an optional set number. The default value for the SetNumber variable is 1.

Examples

To display set number 1, message number 2 of the test.cat catalog, enter:

dspmsg    -s    1    test.cat    2    'message    %s    not    found'    2

If the message is not found, message 2 not found is displayed.

Files

/usr/bin/dspmsg Contains the dspmsg command.

Related Information

The dspcat command, gencat command, mkcatdefs command, runcat command.

The catclose subroutine, catgets subroutine, catopen subroutine.

For more information about the Message Facility, see Message Facility Overview for System Management in AIX Version 4.3 System Management Guide: Operating System and Devices.


[ Previous | Next | Contents | Glossary | Home | Search ]