#!特例
echo 'hello'|sed 's/hello/test/' 将hello替换为test
echo $USER shell查看用户
Nginx下载安装脚本:
#Author: tang hong
#Create Time:2021/9/13 18:00
#Script Description: nginx install script
yum -y install wget gcc pcre-devel zlib-devel
wget http://nginx.org/download/nginx-1.20.1.tar.gz
tar xf nginx-1.20.1.tar.gz
cd nginx-1.20.1
./configure --prefix=/usr/local/nginx
make -j 4
make install
注意nginx的启动命令
cd /usr/local
ls sbin/
./sbin/nginx
编写shell脚本规范,每次写加上
#Author: tang hong
#Create Time:2021/9/13 18:00
#Script Description: nginx install script
History查看历史命令
\转义字符 比如expr 3 \* 3 两边都有空格
echo -n "date is:";date +%F
或者echo "date is:`date +%F`"
echo hh>test.txt 文件内容为hh
echo haha>test.txt 文件内容为haha 会替换为最后一次对的内容
可以重定向echo haha>>test.txt表示追加
wc <test.txt 显示结果为几行,几个单词,多少个字节