System Management

LANG in an interactive Bash shell is en_US.UTF-8. The administrator runs LANG=C sort names.txt and then echo $LANG. What does echo print?

Show the answer

Correct answerB. en_US.UTF-8

AWhy not this: LANG=C applied only to the sort command; the shell's own LANG was not changed.

BWhy this is right: An assignment before a command sets it only for that command, so the shell keeps en_US.UTF-8.

CWhy not this: The prefix assignment does not unset LANG in the shell; it keeps its earlier value.

DWhy not this: C.UTF-8 is a different locale and was never assigned; the shell keeps en_US.UTF-8.

A variable assignment placed directly before a command applies only to that command's environment for its duration. The current shell's LANG is not modified, so it differs from running export LANG=C, which changes the shell and its later child processes.