Automatically set different local codes in Shell and X

Source: Internet
Author: User
Article title: automatically set different local codes under Shell and X. Linux is a technology channel of the IT lab in China. It includes desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic classification reasons:
In The Shell environment, you want to use the English environment, and in the X environment, you want to use the Chinese environment. So we hope that the system can automatically set different local, and the following code will be available.

Principle:
1) determine Shell and X environment: the terminal used in Shell is ttyn, and the terminal used in X is pts/n.
2) in order to automatically set local, you need to write the corresponding code to the user ~ /. Bashrc file

Code:
PHP code: ##### Set locale = POSIX on shell and set locale = zh_CN.UTF-8 on X ###########
Tty = 'tty'
T = 'echo $ tty | awk-F "/" '{print $3 }''
If [$ t = pts]
Then
Export LC_ALL = zh_CN.UTF-8
Fi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.