shell初学者求教

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
LU开拓者
帖子: 59
注册时间: 2012-02-29 10:07

shell初学者求教

#1

帖子 LU开拓者 » 2012-03-02 15:14

#!/bin/bash

read -p "login name:" username
if [ $username = "ubuntu" ]; then
echo "Yes"
else
echo "./If.sh"
fi
exit

怎么让它循环起来
头像
tailsgao
帖子: 209
注册时间: 2010-07-09 7:37

Re: shell初学者求教

#2

帖子 tailsgao » 2012-03-02 15:19

while read
....
done :em11
头像
LU开拓者
帖子: 59
注册时间: 2012-02-29 10:07

Re: shell初学者求教

#3

帖子 LU开拓者 » 2012-03-02 15:25

能详细点么 我新手 刚接触~
头像
Think1st
帖子: 45
注册时间: 2012-02-07 23:08

Re: shell初学者求教

#4

帖子 Think1st » 2012-03-02 15:34

tailsgao 写了:while read
....
done :em11

代码: 全选

#!/bin/bash

while read -p "login name:" username
do
if [ $username = "ubuntu" ]; then
echo "Yes"
else
echo "./If.sh"
fi
done
其实二楼给的挺详细的。
在这里,问题比答案更抢手。
头像
LU开拓者
帖子: 59
注册时间: 2012-02-29 10:07

Re: shell初学者求教

#5

帖子 LU开拓者 » 2012-03-02 15:39

谢谢! :em06
能让它在输入ubuntu的情况下停止执行,而其它情况继续执行么
回复