echo ${VAR//old/new}

Category: Shell & Bash

echo ${VAR//old/new}

Replace all occurrences in variable value

Replaces every occurrence of 'old' with 'new' within a variable's value. // means 'replace all'.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.