!/bin/bash
echo 'sh学习'
echo '变量命名'
your_name="第一个shell"
echo 'your_name:'${your_name}
echo '遍历'
for skill in Ada Coffe Action Java; do
echo "I am good at {string:1:4} # 输出 unoo
echo "查找子字符串"
string="runoob is a great site"
echo expr index "$string" io
# 输出 4
echo "if判断"
a=10
b=20
if [ b ]
then
echo "a 等于 b"
elif [ b ]
then
echo "a 大于 b"
elif [ b ]
then
echo "a 小于 b"
else
echo "没有符合的条件"
fi
网友评论