概述

通過共享簡單的腳本,您可以將Linux服務(wù)器上的點擊語言設(shè)置為中文,并支持以下系統(tǒng):

德比安8/9

Ubuntu 14/16

Centos 6/7

1、腳本內(nèi)容。

請注意,需要聯(lián)網(wǎng)。

#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH # Check System Release if [ -f /etc/redhat-release ]; then release="centos" elif cat /etc/issue | grep -Eqi "debian"; then release="debian" elif cat /etc/issue | grep -Eqi "ubuntu"; then release="ubuntu" elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then release="centos" elif cat /proc/version | grep -Eqi "debian"; then release="debian" elif cat /proc/version | grep -Eqi "ubuntu"; then release="ubuntu" elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then release="centos" fi # Check root [[ $EUID -ne 0 ]] && echo -e "${RED}Error:${PLAIN} This script must be run as root!" && exit 1 # Install some dependencies if [ "${release}" == "centos" ]; then yum -y install wget ca-certificates locales localedef else apt-get update apt-get -y install wget ca-certificates locales fi # Get Word dir dir=$(pwd) # Change Locale if [ "${release}" == "centos" ]; then localedef -v -c -i zh_CN -f UTF-8 z > /dev/null 2>&1 cd /etc rm -rf locale.conf wget > /dev/null 2>&1 cp locale.conf locale cat locale.conf >> /etc/environment elif [ "${release}" == "debian" ]; then rm -rf /etc rm -rf /etc/default/locale rm -rf /etc/defaul cd /etc/ wget https://raw.githubusercontent.com/FunctionClub/LocaleCN/master > /dev/null 2>&1 locale-gen cd /etc/default/ wget > /dev/null 2>&1 cp locale.conf locale elif [ "${release}" == "ubuntu" ]; then rm -rf /etc rm -rf /etc/default/locale rm -rf /etc/defaul cd /etc/ wget https://raw.githubusercontent.com/FunctionClub/LocaleCN/master > /dev/null 2>&1 locale-gen cd /etc/default/ wget > /dev/null 2>&1 cp locale.conf locale fi # Echo Success clear echo "Your Machine Language setting is changed to Chinese(Simplified)" echo "Reconnect to your machine to check it" echo "" echo "copyright by hwb" echo "QQ : 1275758000" # Delete self cd ${dir} rm -rf LocaleCN.sh


3、執(zhí)行結(jié)果:


覺得有用的朋友多幫忙轉(zhuǎn)發(fā)哦!后面會分享更多devops和DBA方面的內(nèi)容,感興趣的朋友可以關(guān)注下~

1.《ubuntu怎么調(diào)語言?總結(jié)很全面速看!詳解如何一鍵設(shè)置Linux服務(wù)器終端顯示語言為中文》援引自互聯(lián)網(wǎng),旨在傳遞更多網(wǎng)絡(luò)信息知識,僅代表作者本人觀點,與本網(wǎng)站無關(guān),侵刪請聯(lián)系頁腳下方聯(lián)系方式。

2.《ubuntu怎么調(diào)語言?總結(jié)很全面速看!詳解如何一鍵設(shè)置Linux服務(wù)器終端顯示語言為中文》僅供讀者參考,本網(wǎng)站未對該內(nèi)容進行證實,對其原創(chuàng)性、真實性、完整性、及時性不作任何保證。

3.文章轉(zhuǎn)載時請保留本站內(nèi)容來源地址,http://f99ss.com/gl/3148321.html