分页: 1 / 1
shell初学者求教
发表于 : 2012-03-02 15:14
由 LU开拓者
#!/bin/bash
read -p "login name:" username
if [ $username = "ubuntu" ]; then
echo "Yes"
else
echo "./If.sh"
fi
exit
怎么让它循环起来
Re: shell初学者求教
发表于 : 2012-03-02 15:19
由 tailsgao
while read
....
done

Re: shell初学者求教
发表于 : 2012-03-02 15:25
由 LU开拓者
能详细点么 我新手 刚接触~
Re: shell初学者求教
发表于 : 2012-03-02 15:34
由 Think1st
tailsgao 写了:while read
....
done

代码: 全选
#!/bin/bash
while read -p "login name:" username
do
if [ $username = "ubuntu" ]; then
echo "Yes"
else
echo "./If.sh"
fi
done
其实二楼给的挺详细的。
Re: shell初学者求教
发表于 : 2012-03-02 15:39
由 LU开拓者
谢谢!
能让它在输入ubuntu的情况下停止执行,而其它情况继续执行么