bash: Use regular expression to replace all patterns in a variable value.



  • Take into account the main readme for this section. README first.

    Syntax is:
    ${name//pattern/string} replace all matches of pattern with string.

    $ echo $ClimateChange
    2021NoDeforestation2021
    $ Amazon=${ClimateChange//2021/2025}
    $ echo $Amazon
    2025NoDeforestation2025
    

Log in to reply
 

© Lightnetics 2024