我有一个程序会输出类似下面的内容:
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
但是我一遍又一遍地得到的只是"stuff=Some"。