[code="java"]
//系统默认的语系
# cat /etc/sysconfig/i18n
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_GB.UTF-8:en_GB:en"
SYSFONT="lat0-sun16"
SYSFONTACM="8859-15"
[/code]
[code="java"]
//本系统所支持的语系
# locale -a
...
yi_US
yi_US.cp1255
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
zh_HK
zh_HK.big5hkscs
zh_HK.utf8
zh_TW
zh_TW.big5
zh_TW.euctw
zh_TW.utf8
[/code]
[code="java"]
//查看环境变量
# export
declare -x BASH_ENV="/root/.bashrc"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="localhost.localdomain"
declare -x INPUTRC="/etc/inputrc"
declare -x LANG="zh_CN.GB18030"
declare -x LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:"
declare -x MAIL="/var/spool/mail/root"
declare -x OLDPWD="/root"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin"
declare -x PWD="/home"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_ASKPASS="/usr/libexec/openssh/gnome-ssh-askpass"
declare -x SSH_CLIENT="192.168.26.195 3176 22"
declare -x SSH_CONNECTION="192.168.26.195 3176 192.168.26.146 22"
declare -x SSH_TTY="/dev/pts/2"
declare -x TERM="xterm"
declare -x USER="root"
declare -x USERNAME="root"
#[/code]
[code="java"]
//主机硬件与内核的等级
# echo $OSTYPE
linux-gnu
# echo $HOSTTYPE
i386
# echo $MACHTYPE
i386-redhat-linux-gnu
[/code]
[code="java"]
//错误代码回传码
# echo $SHELL
/bin/bash
# echo $?
0
# 12name=VBird
-bash: 12name=VBird: command not found
# echo $?
127
[/code]
[code="显示PID(Process ID)"]# echo $$
16374
#
[/code]
[code="生成随机数"]# echo $RANDOM
25882
# declare -i number=$RANDOM*10/32768;echo $number
5
[/code]
[code="env命令查看环境变量"]# env
HOSTNAME=localhost.localdomain
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.26.195 2147 22
SSH_TTY=/dev/pts/1
USER=root
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
USERNAME=root
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
INPUTRC=/etc/inputrc
PWD=/root
LANG=zh_CN.GB18030
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/root
LANGUAGE=zh_CN.GB18030:zh_CN.GB2312:zh_CN
BASH_ENV=/root/.bashrc
LOGNAME=root
SSH_CONNECTION=192.168.26.195 2147 192.168.26.146 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
#[/code]
[code="变量中双引号与单引号的区别"]# words="my kernel is $version"
# echo $words
my kernel is 2.4.20-8
# words='my kernel is $version'
# echo $words
my kernel is $version
[/code]
[code="注意"]若变量需要在其他子进程执行,则需要以export来使变量成为环境变量
# export PATH
[/code]
[code="设置内核版本"]# echo $version
# version=$(uname -r)
# echo $version
2.4.20-8
[/code]
[code="变量的显示与设置"]
# echo $myname
# myname=xiongjiajia
# echo $myname
xiongjiajia
# unset myname
# echo &myname
[/code]
[code="设置目录快捷方式"]# software="/usr/mydocument/software"
# cd $software
[/code]
//系统默认的语系
# cat /etc/sysconfig/i18n
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_GB.UTF-8:en_GB:en"
SYSFONT="lat0-sun16"
SYSFONTACM="8859-15"
[/code]
[code="java"]
//本系统所支持的语系
# locale -a
...
yi_US
yi_US.cp1255
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
zh_HK
zh_HK.big5hkscs
zh_HK.utf8
zh_TW
zh_TW.big5
zh_TW.euctw
zh_TW.utf8
[/code]
[code="java"]
//查看环境变量
# export
declare -x BASH_ENV="/root/.bashrc"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="localhost.localdomain"
declare -x INPUTRC="/etc/inputrc"
declare -x LANG="zh_CN.GB18030"
declare -x LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:"
declare -x MAIL="/var/spool/mail/root"
declare -x OLDPWD="/root"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin"
declare -x PWD="/home"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_ASKPASS="/usr/libexec/openssh/gnome-ssh-askpass"
declare -x SSH_CLIENT="192.168.26.195 3176 22"
declare -x SSH_CONNECTION="192.168.26.195 3176 192.168.26.146 22"
declare -x SSH_TTY="/dev/pts/2"
declare -x TERM="xterm"
declare -x USER="root"
declare -x USERNAME="root"
#[/code]
[code="java"]
//主机硬件与内核的等级
# echo $OSTYPE
linux-gnu
# echo $HOSTTYPE
i386
# echo $MACHTYPE
i386-redhat-linux-gnu
[/code]
[code="java"]
//错误代码回传码
# echo $SHELL
/bin/bash
# echo $?
0
# 12name=VBird
-bash: 12name=VBird: command not found
# echo $?
127
[/code]
[code="显示PID(Process ID)"]# echo $$
16374
#
[/code]
[code="生成随机数"]# echo $RANDOM
25882
# declare -i number=$RANDOM*10/32768;echo $number
5
[/code]
[code="env命令查看环境变量"]# env
HOSTNAME=localhost.localdomain
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.26.195 2147 22
SSH_TTY=/dev/pts/1
USER=root
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
USERNAME=root
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
INPUTRC=/etc/inputrc
PWD=/root
LANG=zh_CN.GB18030
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/root
LANGUAGE=zh_CN.GB18030:zh_CN.GB2312:zh_CN
BASH_ENV=/root/.bashrc
LOGNAME=root
SSH_CONNECTION=192.168.26.195 2147 192.168.26.146 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
#[/code]
[code="变量中双引号与单引号的区别"]# words="my kernel is $version"
# echo $words
my kernel is 2.4.20-8
# words='my kernel is $version'
# echo $words
my kernel is $version
[/code]
[code="注意"]若变量需要在其他子进程执行,则需要以export来使变量成为环境变量
# export PATH
[/code]
[code="设置内核版本"]# echo $version
# version=$(uname -r)
# echo $version
2.4.20-8
[/code]
[code="变量的显示与设置"]
# echo $myname
# myname=xiongjiajia
# echo $myname
xiongjiajia
# unset myname
# echo &myname
[/code]
[code="设置目录快捷方式"]# software="/usr/mydocument/software"
# cd $software
[/code]