以下是我写处理从一个字符串数组通配符扩展在bash shell脚本
line="/path/IntegrationFilter.java:150: * <td>http://abcd.com/index.do</td>"
echo "$line" <-- "$line" prints the text correctly
result_array=(`echo "$line"| sed 's/:/\n/1' | sed 's/:/\n/1'`)
echo "${result_array[0]}"
echo "${result_array[1]}"
echo "${result_array[2]}" <-- prints the first filename in the directory due to wildcard character * .
如何获取文本的示例脚本“* http://abcd.com/index.do”从数组中检索时打印而不是文件名?
它适用于我,我将使用第二种解决方案。感谢Mikel! – ranjit 2011-04-13 06:18:57