我有一个输出如下内容的程序:
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”。