我有一个程序,输出是这样的:读串入一个变量,直到在BASH某个词
stuff=Some text with spaces and other $pecial characters stuff2=1 stuff3=0
我想在一个变量来获取所有的字符串,直到stuff2 = 1,所以变量是:
stuff=Some text with spaces and other $special characters
我已经试过这样:
for word in $output
while [ $word != "stuff2=1" ]
do
var+=" "$word
done
done
,但我得到的是“东西=一些”过来,再次。
非常感谢!这工作完美。 – NStorm 2013-04-27 02:20:03