#!/bin/bash
: #This is my an exp programme
: echo "Please input the file name: \C -n"
: read name
: touch $name
: echo "$name :"
: for ((i=1;i<30;i++))
: do
: read line[$i]
: if line[$i]=“:end”
: then
: break
: fi
: cat>$name
: done
: echo "Bye!"
: 为啥一输入就break了???
shell脚本的问题
-
- 帖子: 15
- 注册时间: 2008-05-13 20:25
shell脚本的问题
感受LINUX的精神
- xiooli
- 帖子: 6956
- 注册时间: 2007-11-19 21:51
- 来自: 成都
- 联系:
-
- 帖子: 15
- 注册时间: 2008-05-13 20:25
-
- 帖子: 15
- 注册时间: 2008-05-13 20:25
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
代码: 全选
#!/bin/bash
#This is my an exp programme
echo -n "Please input the file name: "
read name
echo "$name :"
echo -n > "$name"
read line
while [ "$line" != ':end' ]
do
echo "$line" >> "$name"
read line
done
echo "Bye!"
^_^ ~~~
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
-
- 帖子: 15
- 注册时间: 2008-05-13 20:25
那我原先写的那个哪有问题啊?echo -n > "$name"和echo "$line" >> "$name"是什么意思呢?BigSnake.NET 写了:代码: 全选
#!/bin/bash #This is my an exp programme echo -n "Please input the file name: " read name echo "$name :" echo -n > "$name" read line while [ "$line" != ':end' ] do echo "$line" >> "$name" read line done echo "Bye!"
感受LINUX的精神