标签:生效 messages home paper 系统命令 openssl ica 调用 measure
一、用户自定义变量name=‘zhangsan‘
echo $name
echo ${name}
name=zhangsan
name= ${name}" hello world"
name="$name is good"
echo $name
echo $name
echo ${name}
set centos版查看已经生效的变量(系统变量和认为自定义变量)
echo $notExistsVar
set -u
echo $notExistsVar
zsh: notExistsVar: parameter not set
unset name
问:环境变量和用户变量的区别?
答:环境变量的作用是全局的,而用户自定义变量是局部变量。
用户自定义变量只能在当前的shell中生效
环境变量在当前shell和这个shell的所有子shell中都生效
方式1:export 变量名=变量值
方式2:变量名=变量值
export 变量名
env 查看当前用户的环境变量
系统搜索命令的路径
cd /home/zrj/www/zhangrenjie_test/test/shell
chmod +x ./hello.sh
sudo cp ./hello.sh /bin
在系统任何地方都可以执行hello.sh
echo $PATH
PATH=/home/zrj/bin:/home/zrj/.local/bin:/usr/local/openssl/bin:/home/zrj/bin:/home/zrj/.local/bin:/usr/local/openssl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/lampp/bin:/home/zrj/bin:~/.composer/vendor/bin:/opt/lampp/bin:/home/zrj/bin:~/.composer/vendor/bin
PATH="$PATH:/home/zrj/www/zhangrenjie_test/test/shell"
#这里使用变量叠加
echo $PATH
/home/zrj/bin:/home/zrj/.local/bin:/usr/local/openssl/bin:/home/zrj/bin:/home/zrj/.local/bin:/usr/local/openssl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/lampp/bin:/home/zrj/bin:~/.composer/vendor/bin:/opt/lampp/bin:/home/zrj/bin:~/.composer/vendor/bin:/home/zrj/www/zhangrenjie_test/test/shell
locale
#查看当前系统语系
LANG 定义系统主语系的变量
LC_ALL定义整体语系的变量
zrj@zrj:~/www/admin/yundou-admin$ locale
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:en
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES=zh_CN.utf8
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=
echo $LANG
locale -a
即下次开机后开机后默认的系统语系环境
cat /etc/sysconfig/i18n
标签:生效 messages home paper 系统命令 openssl ica 调用 measure
原文地址:http://blog.51cto.com/phpme/2319047