^word^replacement^ on all matches in Bash?

bash, sh, shell

Solution

Try this:

$ echo oneone
oneone
$ !!:gs/one/two/    # Repeats last command; substitutes 'one' --> 'two'.
twotwo

Problem

To clarify, I am looking for a way to perform a global search and replace on the previous command used. `^word^replacement^` only seems to replace the first match. Is there some `set` option that is eluding me?

Original source

Related problems