从bash shell linux中的字符串中删除单词的所有出现

MOH*_*MED 3 string bash shell

我有以下字符串

str="toto1 toto2 toto3 toto4 toto2 toto5"
Run Code Online (Sandbox Code Playgroud)

toto2字符串中出现了两次.如何toto2从字符串中删除所有出现的内容?

我试过这个:

echo ${str/toto2/}
Run Code Online (Sandbox Code Playgroud)

但这只会删除第一次出现的toto2.

toto1 toto3 toto4 toto2 toto5 # output
Run Code Online (Sandbox Code Playgroud)

如何toto2从字符串中删除所有出现的内容?

MOH*_*MED 9

找到了.解决方案是:

echo ${str//toto2/}
Run Code Online (Sandbox Code Playgroud)