|

楼主 |
发表于 2003-2-9 10:47:04
|
显示全部楼层
我想到的两种方法:
方法1:
- while read strings; do
- echo -e $strings
- done < file
复制代码
方法2:
- #!/bin/bash
- string="FreeBSD\nNetBSD\nLinux\nSolaris"
- :
- while [ $? = 0 ]; do
- temp=${string%%\\n*}
- echo $temp
- string=${string#${temp}\\n}
- echo $string | grep \\n > /dev/null
- if [ $? != 0 ]; then
- echo $string
- false
- fi
- done
复制代码
大家看看还有没有其它更简便的方法. |
|