xie-wen-hui
船帆虽小,却也能远航!

Bash介绍

1. 常用的快捷键

ctrl+c		终止当前运行程序
ctrl+z		挂起当前运行程序
ctrl+d		退出=exit
ctrl+l		清屏=clear
ctrl+a|home		把光标移到命令最前端
ctrl+e|end		把光标移到命令最后端
ctrl+u		删除光标前所有的字符
ctrl+k		删除光标后所有字符
ctrl+r		搜索历史命令

$\textcolor{orange}{2.常用的通配符}$

*:		匹配0或多个任意字符
?:		匹配任意一个字符
[list]:		匹配列表中任意字符
[!list]:	匹配除去列表中任意字符
{string1,string2...}	匹配string1,string2或多个字符
{string1..string2}	匹配string1到string2等多个字符

$\textcolor{orange}{3.bash中的引号''}$

# 双引号"":  会当成一个整体,可通过$符号作变量名

# 单引号'':  会当成一个整体,不能作为变量值

# 反撇号``:  反撇号=$(),引号\括号会被优先执行,如果存在嵌套,则不能使用反撇号
# 代码演示''  ""  ``的应用区别
# 结论:''只能作为字符串符号,""可以变量符号,``=$()

[root@localhost home]# date +%F
2020-11-30
[root@localhost home]# echo 'date +%F'
date +%F
[root@localhost home]# echo "date +%F"
date +%F
[root@localhost home]# echo "$(date +%F)"
2020-11-30
[root@localhost home]# echo '$(date +%F)'
$(date +%F)
[root@localhost home]# echo `$(date +%F)`
bash: 2020-11-30: 未找到命令...

[root@localhost home]# echo `date +%F`
2020-11-30
[root@localhost home]# 

posted on 2021-01-17 13:54  xie-wen-hui  阅读(94)  评论(0)    收藏  举报