shell脚本判断

条件判断
if格式:
if 条件;then
内容
elif 条件;then
内容
else
内容
fi

case格式:
case 变量引用 in
PAT1}
内容;;
PAT2)
内容;;
....
*)
内容;;
esac

shell配置文件读取顺序
交互式登录:/etc/profile-->/etc/profile.d/.sh-->~/.bash_profile-->~/.bashrc-->/etc/bashrc
非交互式登录:/etc/profile.d/
.sh-->/etc/bashrc-->~/.bashrc

猜你喜欢

转载自blog.51cto.com/14133915/2338024