LOCALE(1) | User Commands | LOCALE(1) |
locale - get locale-specific information
locale [-a | -m]
locale [-ck] name...
The locale utility writes information about the current locale environment, or all public locales, to the standard output. For the purposes of this section, a public locale is one provided by the implementation that is accessible to the application.
When locale is invoked without any arguments, it summarizes the current locale environment for each locale category as determined by the settings of the environment variables.
When invoked with operands, it writes values that have been assigned to the keywords in the locale categories, as follows:
The following options are supported:
-a
-c
-k
-m
The following operand is supported:
name
Example 1 Examples of the locale utility
In the following examples, the assumption is that locale environment variables are set as follows:
LANG=locale_x LC_COLLATE=locale_y
The command locale would result in the following output:
LANG=locale_x LC_CTYPE="locale_x" LC_NUMERIC="locale_x" LC_TIME="locale_x" LC_COLLATE=locale_y LC_MONETARY="locale_x" LC_MESSAGES="locale_x" LC_ALL=
The command
LC_ALL=POSIX locale -ck decimal_point
would produce:
LC_NUMERIC decimal_point="."
The following command shows an application of locale to determine whether a user-supplied response is affirmative:
if printf "%s\n" "$response" | /usr/bin/grep -Eq\
"$(locale yesexpr)" then
affirmative processing goes here else
non-affirmative processing goes here fi
See environ(7) for the descriptions of LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The LANG, LC_*, and NLSPATH environment variables must specify the current locale environment to be written out. These environment variables will be used if the -a option is not specified.
The following exit values are returned:
0
>0
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
Interface Stability | Standard |
localedef(1), attributes(7), charmap(7), environ(7), locale(7), standards(7)
If LC_CTYPE or keywords in the category LC_CTYPE are specified, only the values in the range 0x00-0x7f are written out.
If LC_COLLATE or keywords in the category LC_COLLATE are specified, no actual values are written out.
November 28, 2017 | OmniOS |