#环境变量
Echo $HOSTNAME #主机名
Echo $SHELL #目前用的哪个解释器
Echo $PATH #命令搜索路径
Echo $USER #使用的哪个用户
Echo $PWD #当前目录
Echo $HOME #家目录是哪个
Echo $LOGNAME #哪个用户
# positional variables
Echo
echo $
Echo
echo $
Echo $* #显示所有位置值
Echo $# #显示位置值的总数量
echo $$ # Process number PID of the current process
echo $? #判断上一条是否成功, 0 successful, others are unsuccessful
Echo $! #Shell最后运行的后台进程的PID
#特殊符号
"$ABC" #双引 (Reference whole)
' $abc ' #单引 (reference whole, special symbol does not work)
' Date +%y%n%d ' #反引 (Put the executable command, return the result of the command) $ (date) = ' Date '
{variable name} parameter #{} is the variable name, and if not, echo ${a}b may not be recognized
#read配置
READ-P "hint Information" variable name #定义变量名, but does not give value
Useradd $ variable Value #给变量值
-S #输入的数值不可见
-T 3 #设置时间秒, null value exceeded
-N 3 #设置字符数量, achieves immediate execution
#历史命令使用
History
!cat #执行cat开头的最近那条历史命令
!100 #执行第100条历史命令
Stty Echo #开启显示
Stty-echo #关闭显示
Export variable #将局部变成全局 (define system variable) global variable best capitalization
Export-n variable name #取消全局属性 local variable preferably lowercase
Env #列出环境变量
Set #列出所有变量
Unset #取消定义的变量
#脚本执行3种方式
./Script
Bash script
The document where the source script resides
Shell Script 1.1