Bruce
Bruce

Reputation: 35233

What is the effect of the PS1 and LC_ALL-variables in Bash?

I have a .bashrc file with the following commands:

   PS1="..."
   export LC_ALL=...

What are these commands doing?

Upvotes: 1

Views: 718

Answers (3)

Michael Aaron Safyan
Michael Aaron Safyan

Reputation: 95479

The first one sets the way your prompt looks (see my own post on pimping my prompt). In the case of the example you gave, it will cause your hostname, followed by a colon, followed by the current path to appear in the prompt. The second one sets the default language/localization settings to use the POSIX C configuration, rather than whatever the settings previously were. I strongly recommend changing the value from "C" to some variation of "utf-8" depending on your language, in order to support Unicode. Ex:

export LANG=en_US.utf-8
export LC_ALL=en_US.utf-8

Upvotes: 1

Kerrek SB
Kerrek SB

Reputation: 476960

The first one, provided it's exported or otherwise propagated to the user's shell process, sets the format of the command prompt, i.e. the little text at the beginning of the line that reads your input. Check out the "PROMPTING" section in man bash.

The second line exports the LC_ALL variable with value C, which sets your locale (to the standard "C" locale). If you experience internationalization-related problems, this may need to be changed.

Upvotes: 1

Ed Heal
Ed Heal

Reputation: 59997

PS1=.. Is setting the value of the prompt that is displayed

export LC_ALL is settiing an environment variable that will be available to programmes that bash executes. See http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html

Upvotes: 1

Related Questions