expansion
Bash Replace all matches
Replaces all matches; an unquoted ampersand in replacement can denote matched text with patsub_replacement enabled on Bash 5.2.
Formal Syntax & Structure
bash syntaxbash
${p//pattern/string}Return Value
shell expansion result
Replaces all matches; an unquoted ampersand in replacement can denote matched text with patsub_replacement enabled on Bash 5.2.
Working Example
Example Snippetbash
p=a-aprintf '%s\n' "${p//a/b}"