Chinaunix
标题:
for循环的问题
[打印本页]
作者:
see_3000
时间:
2010-12-29 15:10
标题:
for循环的问题
本帖最后由 see_3000 于 2010-12-29 15:14 编辑
有个问题
database 内容为
dababase number1
database number2
database number no2
复制代码
使用for 循环来处理时候
for i in $database; do
echo $i
done
复制代码
无法显示整行的,被截断了,有办法解决么?
作者:
lkk2003rty
时间:
2010-12-29 15:27
改一下IFS
作者:
wtuter
时间:
2010-12-29 15:27
回复
1#
see_3000
while read
作者:
see_3000
时间:
2010-12-29 18:00
回复
2#
lkk2003rty
IFS 更改,貌似不行。
作者:
see_3000
时间:
2010-12-29 18:01
回复
3#
wtuter
能给个示例么?我的问题其实是postgre SQL 数据库名字有空格,用shell筛选名字的时候不正确导致备份失败。
作者:
wtuter
时间:
2010-12-29 18:16
回复
5#
see_3000
cat ufiel|while read a;do echo $a;done
作者:
jiaminqiang
时间:
2010-12-31 11:15
#!/bin/bash
while read line
do
echo $line
done<$database
作者:
Shell_HAT
时间:
2010-12-31 13:22
while IFS=, read line;
do
echo $line
done <<< "$database"
复制代码
作者:
Shell_HAT
时间:
2010-12-31 13:23
(IFS=,; for i in $database; do echo $i; done)
复制代码
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2