Environment variables are properties of all processes, not just bash processes. They can be read by other programming languages, such as C, Perl, Awk, or Python. This means that environment variables are sometimes used to affect how another program runs.
For example, the sort program uses locale settings to decide the sort order for some strings – specifically, it uses the LANG or LC_COLLATE environment variables. If LC_COLLATE is set to en_US.UTF-8, it will sort lowercase a before uppercase A:
$ printf '%s\n' 'alligator' 'Alfred' >words $ LC_COLLATE=en_US.UTF-8 $ export LC_COLLATE $ sort words alligator Alfred
However, if the environment variable is then set to C, its behavior changes:
$ LC_COLLATE=C $ sort words Alfred alligator
There's a shortcut here: we can call a program with a modified environment by putting environment variable assignments before the call to the program, on the same line:
$ LC_COLLATE=C sort words Alfred alligator
This sets the LC_COLLATE environment variable to C for the sort call, but doesn't change it in the rest of the script.
This combination of assignment syntax and command-line call is very useful, but it's also not very intuitive, because the presence of a command after the variable assignments changes what the assignments mean more or less entirely. Make sure you understand the difference between these two lines:
mycollate=C LC_COLLATE=C sort words
The first is defining a shell variable named mycollate to the value C. The second is defining only an environment variable, and only for the sort call that it starts on the words file, not the rest of the script.