Package: debian-reference
Severity: normal

The following is the contents of the 
http://www.debian.org/doc/manuals/debian-reference/ch01.en.html#_literal_lang_literal_variable
 chapter.

However, I find it weird, and not really compliant to what I can see on my 
system.

  Typical command execution uses a shell line sequence as the following.

  $ date
  Sun Jun  3 10:27:39 JST 2007
  $ LANG=fr_FR.UTF-8 date
  dimanche 3 juin 2007, 10:27:33 (UTC+0900)

  Here, the program date(1) is executed with different values of the 
environment variable "$LANG".

    For the first command, "$LANG" is set to the system default locale value 
"en_US.UTF-8".

    For the second command, "$LANG" is set to the French UTF-8 locale value 
"fr_FR.UTF-8".

  Most command executions usually do not have preceding environment variable 
definition. For the above example, you can alternatively execute as the 
following.

  $ LANG=fr_FR.UTF-8
  $ date
  dimanche 3 juin 2007, 10:27:33 (UTC+0900)

  As you can see here, the output of command is affected by the environment 
variable to produce French output. If you want the environment variable to be 
inherited to subprocesses (e.g., when calling shell script), you need to export 
it instead by the following.

  $ export LANG

When in a user's terminal, typically, it seems to me that given that LANG is 
already exported ('export -p' reports 'declare -x LANG="en_US.UTF-8"'), there 
is no need to do another additional export LANG.

I think it would make more sense to write this the following way :

  Typical command execution uses a shell line sequence as the following.

  $ date
  Sun Jun  3 10:27:39 JST 2007

  Here, the program date(1) is executed with a value of the environment 
variable "$LANG" set to the system default locale value "en_US.UTF-8".

  We can change that variable to the French UTF-8 locale value "fr_FR.UTF-8" :
  $ export LANG
  $ LANG=fr_FR.UTF-8
  $ date
  dimanche 3 juin 2007, 10:27:33 (UTC+0900)

  Note that it is generally not needed to explicitely export LANG, as it is 
already marked as being exported in the shell environment (check with export 
-p).

  In the above, as the LANG is now set to fr_FR.UTF-8 in the current shell 
context, it will apply to all further subprocess launched (e.g., when calling 
shell script).

  If you don't want to change it for the rest of the command invocations, but 
want to limit the setting of LANG for the invocation of a single command, you 
may instead use a preceding environment variable definition as in :

  $ LANG=fr_FR.UTF-8 date
  dimanche 3 juin 2007, 10:27:33 (UTC+0900)
  $ date
  Sun Jun  3 10:27:39 JST 2007

I wonder if this hasn't been somehow like this in the past, as the current 
initial example has dates in a non-chronologic sequence, apparently :-/

Hope this helps.

Best regards,


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-3-686-pae (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to