bash: Use regular expression to delete part of a variable value.



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

    Syntax is:
    ${name/pattern} replace first match of pattern with string.

    Here we delete the "Less" part of LessDeforestation.

    $ echo $ClimateChange
    LessDeforestation
    $ Amazon=${ClimateChange/Less}
    $ echo $Amazon
    Deforestation
    

Log in to reply
 

© Lightnetics 2024