🎨Bash基础入门与应用
Shell执行方式
bash hello.sh #方式一
cat hello.sh | bash #方式二
bash < hello.sh #方式三
chmod +x hello.sh #方式四
#方式五
source hello.sh
#source有一个简写形式,可以使用一个点(.)来表示。
#方式六,远程加载执行
curl -s http://localhost/hello.sh |bash
#wget方式
wget -qO - http://localhost/hello.sh|bash配置文件
/etc/profile
/etc/profile.d/*.sh
/etc/bashrc
#只针对个人
~/.bash_profile
~/.bashrc环境变量
位置、特殊变量
脚本调试
字符串操作
判断
read
流程控制
条件判断case语句
循环
定义函数
Last updated