msgid "" msgstr "" "X-Pootle-Revision: 9999999\n" "X-Pootle-Path: /zh_CN/lfs/chapter09/profile.po\n" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2020-09-02 17:31+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Translate Toolkit 2.2.5\n" #. type: Content of: msgid "The Bash Shell Startup Files" msgstr "Bash Shell 启动文件" #. type: Content of: <sect1><indexterm><primary> msgid "/etc/profile" msgstr "/etc/profile" #. type: Content of: <sect1><para> msgid "" "The shell program <command>/bin/bash</command> (hereafter referred to as " "<quote>the shell</quote>) uses a collection of startup files to help create " "an environment to run in. Each file has a specific use and may affect login " "and interactive environments differently. The files in the <filename class=" "\"directory\">/etc</filename> directory provide global settings. If an " "equivalent file exists in the home directory, it may override the global " "settings." msgstr "" "Shell 程序 <command>/bin/bash</command> (之后简称 <quote>shell</quote>) 使用" "一组启动文件,以帮助创建运行环境。每个文件都有专门的用途,它们可能以不同方式" "影响登录和交互环境。<filename class=\"directory\">/etc</filename> 中的文件提" "供全局设定。如果在用户主目录中有对应的文件存在,它可能覆盖全局设定。" #. type: Content of: <sect1><para> msgid "" "An interactive login shell is started after a successful login, using " "<command>/bin/login</command>, by reading the <filename>/etc/passwd</" "filename> file. An interactive non-login shell is started at the command-" "line (e.g., <prompt>[prompt]$</prompt><command>/bin/bash</command>). A non-" "interactive shell is usually present when a shell script is running. It is " "non-interactive because it is processing a script and not waiting for user " "input between commands." msgstr "" "在成功登录后,<command>/bin/login</command> 读取 <filename>/etc/passwd</" "filename> 中的 shell 命令行,启动一个交互式登录 shell。通过命令行 (如 " "<prompt>[prompt]$</prompt><command>/bin/bash</command>) 启动的 shell 是交互式" "非登录 shell。非交互 shell 通常在运行 shell 脚本时存在,它处理脚本,在执行命" "令的过程中不等待用户输入,因此是非交互的。" #. type: Content of: <sect1><para> msgid "" "For more information, see <command>info bash</command> under the " "<emphasis>Bash Startup Files and Interactive Shells</emphasis> section." msgstr "" "阅读 <command>info bash</command> 中的 <emphasis>Bash Startup Files and " "Interactive Shells</emphasis> 一节,了解更多信息。" #. type: Content of: <sect1><para> msgid "" "The files <filename>/etc/profile</filename> and <filename>~/.bash_profile</" "filename> are read when the shell is invoked as an interactive login shell." msgstr "" "登录 shell 会读取文件 <filename>/etc/profile</filename> 和 <filename>~/." "bash_profile</filename>。" #. type: Content of: <sect1><para> msgid "" "The base <filename>/etc/profile</filename> below sets some environment " "variables necessary for native language support. Setting them properly " "results in:" msgstr "" "下面给出最基本的 <filename>/etc/profile</filename> 文件,它设定本地语言支持所" "需的一些环境变量。正确设定它们有以下好处:" #. type: Content of: <sect1><itemizedlist><listitem><para> msgid "The output of programs translated into the native language" msgstr "程序输出被翻译成本地语言" #. type: Content of: <sect1><itemizedlist><listitem><para> msgid "" "Correct classification of characters into letters, digits and other classes. " "This is necessary for <command>bash</command> to properly accept non-ASCII " "characters in command lines in non-English locales" msgstr "" "字符被正确分类为字母,数字,以及其他类型。在非英文 locale 中,这对于使 " "<command>bash</command> 正确接受命令行中的非 ASCII 字符是必要的。" #. type: Content of: <sect1><itemizedlist><listitem><para> msgid "The correct alphabetical sorting order for the country" msgstr "根据所在地区惯例排序字母" #. type: Content of: <sect1><itemizedlist><listitem><para> msgid "Appropriate default paper size" msgstr "适用于所在地区的默认纸张尺寸" #. type: Content of: <sect1><itemizedlist><listitem><para> msgid "Correct formatting of monetary, time, and date values" msgstr "正确格式化货币,时间,以及日期值" #. type: Content of: <sect1><para> msgid "" "Replace <replaceable><ll></replaceable> below with the two-letter code " "for the desired language (e.g., <quote>en</quote>) and <replaceable><" "CC></replaceable> with the two-letter code for the appropriate country (e." "g., <quote>GB</quote>). <replaceable><charmap></replaceable> should be " "replaced with the canonical charmap for your chosen locale. Optional " "modifiers such as <quote>@euro</quote> may also be present." msgstr "" "将下面的 <replaceable><ll></replaceable>替换为所需语言的双字符代号 (例" "如 <quote>en</quote>),<replaceable><CC></replaceable> 替换为国家或地区" "的双字符代号 (例如 <quote>GB</quote>),<replaceable><charmap></" "replaceable> 替换为您选定的 locale 的标准字符映射。另外,还可以加入 " "<quote>@euro</quote> 等可选修饰符。" #. type: Content of: <sect1><para> msgid "" "The list of all locales supported by Glibc can be obtained by running the " "following command:" msgstr "Glibc 支持的所有 locale 可以用以下命令列出:" #. type: Content of: <sect1><screen> #, no-wrap msgid "<userinput>locale -a</userinput>" msgstr "<userinput>locale -a</userinput>" #. type: Content of: <sect1><para> msgid "" "Charmaps can have a number of aliases, e.g., <quote>ISO-8859-1</quote> is " "also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>. " "Some applications cannot handle the various synonyms correctly (e.g., " "require that <quote>UTF-8</quote> is written as <quote>UTF-8</quote>, not " "<quote>utf8</quote>), so it is safest in most cases to choose the canonical " "name for a particular locale. To determine the canonical name, run the " "following command, where <replaceable><locale name></replaceable> is " "the output given by <command>locale -a</command> for your preferred locale " "(<quote>en_GB.iso88591</quote> in our example)." msgstr "" "字符映射可能有多个别名,例如 <quote>ISO-8859-1</quote> 也可以称为 " "<quote>iso8859-1</quote> 或者 <quote>iso88591</quote>。某些程序不能正确处理一" "些别名 (例如,<quote>UTF-8</quote>必须写作<quote>UTF-8</quote>才能识别,而不" "能识别<quote>utf8</quote>),因此在多数情况下,为了保险起见,最好使用 locale " "的规范名称。为了确定规范名称,执行以下命令,将 <replaceable><locale 名>" "</replaceable> 替换成 <command>locale -a</command> 对于您希望的 locale 的输" "出 (以 <quote>en_GB.iso88591</quote> 为例)。" #. type: Content of: <sect1><screen> #, no-wrap msgid "<userinput>LC_ALL=<replaceable><locale name></replaceable> locale charmap</userinput>" msgstr "<userinput>LC_ALL=<replaceable><locale 名></replaceable> locale charmap</userinput>" #. type: Content of: <sect1><para> msgid "" "For the <quote>en_GB.iso88591</quote> locale, the above command will print:" msgstr "对于 <quote>en_GB.iso88591</quote> locale,以上命令输出:" #. type: Content of: <sect1><screen> #, no-wrap msgid "<computeroutput>ISO-8859-1</computeroutput>" msgstr "<computeroutput>ISO-8859-1</computeroutput>" #. type: Content of: <sect1><para> msgid "" "This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>. " "It is important that the locale found using the heuristic above is tested " "prior to it being added to the Bash startup files:" msgstr "" "这样就最终确定 locale 应设置为 <quote>en_GB.ISO-8859-1</quote>。在将以上启发" "方法获得的 locale 添加到 Bash 启动文件之前,一定要进行下列测试:" #. type: Content of: <sect1><screen> #, no-wrap msgid "" "<userinput>LC_ALL=<locale name> locale language\n" "LC_ALL=<locale name> locale charmap\n" "LC_ALL=<locale name> locale int_curr_symbol\n" "LC_ALL=<locale name> locale int_prefix</userinput>" msgstr "" "<userinput>LC_ALL=<locale 名> locale language\n" "LC_ALL=<locale 名> locale charmap\n" "LC_ALL=<locale 名> locale int_curr_symbol\n" "LC_ALL=<locale 名> locale int_prefix</userinput>" #. type: Content of: <sect1><para> msgid "" "The above commands should print the language name, the character encoding " "used by the locale, the local currency, and the prefix to dial before the " "telephone number in order to get into the country. If any of the commands " "above fail with a message similar to the one shown below, this means that " "your locale was either not installed in <xref linkend=\"ch-system-glibc\"/> " "or is not supported by the default installation of Glibc." msgstr "" "以上命令应该输出语言名称,选定 locale 使用的字符编码,本地货币符号,以及所在" "国家或地区的国际电话区号。如果以上某个命令失败并输出类似下面这样的消息,意味" "着您的 locale 在<xref linkend=\"ch-system-glibc\"/>中没有安装,或者不被 " "Glibc 的默认安装支持。" #. type: Content of: <sect1><screen> #, no-wrap msgid "<computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput>" msgstr "<computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput>" #. type: Content of: <sect1><para> msgid "" "If this happens, you should either install the desired locale using the " "<command>localedef</command> command, or consider choosing a different " "locale. Further instructions assume that there are no such error messages " "from Glibc." msgstr "" "如果出现了这种消息,您应该用 <command>localedef</command> 命令安装所需的 " "locale,或重新选择一个不同的 locale。后文假设 Glibc 没有输出类似错误消息。" #. type: Content of: <sect1><para> msgid "" "Other packages can also function incorrectly (but may not necessarily " "display any error messages) if the locale name does not meet their " "expectations. In those cases, investigating how other Linux distributions " "support your locale might provide some useful information." msgstr "" "其他软件包在 locale 名不符合它们的期望时可能工作不正常(但未必输出错误消息)。" "在这种情况下,探索一下其他 Linux 发行版是如何支持您的 locale 的,可以得到一些" "有用的信息。" #. type: Content of: <sect1><para> msgid "" "Once the proper locale settings have been determined, create the <filename>/" "etc/profile</filename> file:" msgstr "" "在确定了正确的 locale 设置后,创建 <filename>/etc/profile</filename> 文件:" #. type: Content of: <sect1><screen> #, no-wrap msgid "" "<userinput>cat > /etc/profile << \"EOF\"\n" "<literal># Begin /etc/profile\n" "\n" "export LANG=<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable>\n" "\n" "# End /etc/profile</literal>\n" "EOF</userinput>" msgstr "" "<userinput>cat > /etc/profile << \"EOF\"\n" "<literal># Begin /etc/profile\n" "\n" "export LANG=<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable>\n" "\n" "# End /etc/profile</literal>\n" "EOF</userinput>" #. type: Content of: <sect1><para> msgid "" "The <quote>C</quote> (default) and <quote>en_US.utf8</quote> (the " "recommended one for United States English users) locales are different. " "<quote>C</quote> uses the US-ASCII 7-bit character set, and treats bytes " "with the high bit set as invalid characters. That's why, e.g., the " "<command>ls</command> command substitutes them with question marks in that " "locale. Also, an attempt to send mail with such characters from Mutt or Pine " "results in non-RFC-conforming messages being sent (the charset in the " "outgoing mail is indicated as <quote>unknown 8-bit</quote>). So you can use " "the <quote>C</quote> locale only if you are sure that you will never need 8-" "bit characters." msgstr "" "<quote>C</quote> (默认 locale) 和<quote>en_US</quote>(推荐美式英语用户使用的 " "locale) 是不同的。<quote>C</quote> locale 使用 US-ASCII 7 位字符集,并且将最" "高位为 1 的字节视为无效字符。因此,<command>ls</command> 等命令会将它们替换为" "问号。另外,如果试图用 Mutt 或 Pine 发送包含这些字符的邮件,会发出不符合 RFC " "标准的消息 (发出邮件的字符集会被标为<quote>未知 8 位</quote>)。因此,您只能在" "确信自己永远不会使用 8 位字符时才能使用<quote>C</quote> locale。" #. type: Content of: <sect1><para> msgid "" "UTF-8 based locales are not supported well by some programs. Work is in " "progress to document and, if possible, fix such problems, see <ulink url=" "\"&blfs-book;introduction/locale-issues.html\"/>." msgstr "" "许多程序不能很好地支持基于 UTF-8 的 locale。我们正在努力记录并 (如果可能的" "话) 修复它们,参阅 <ulink url=\"&blfs-book;introduction/locale-issues.html\"/" ">。"