1.命令替换
把命令中某个子命令替换为其执行结果
格式
“$(替换内容)”
or
“the is ``” 双引号内使用反引号括住需要替换的内容
$()
echo "the current 、directory is $(pwd)."
touch ./file$(data +%H+%M+%S).txt
..
echo "the current directory is ·pwd·"
echo 'the current directory is ·pwd·'
bash支持的引号
"" 双引号,可以实现变量替换
'' 强引用,不完成变量替换
·· 反引号,命令替换
举例:
echo “当前系统的第三个用户是$(head -3 /etc/passwd | tail -1| cut -d : -f 1)”
当前系统的第三个用户是daemon;
2.tab 自动补齐
1.命令补齐
系统会在在PATH环境变量下搜索补全要输入的命令
2.路径补齐
在输入的字符开始的路径下补齐
3.选项补齐
在输入命令之后,可以自动补全选项