Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 53
    Correct answer is below Commented Mar 19, 2018 at 17:40
  • 1
    @JoãoAngelo Would you clarify why this was marked has the correct one over the other answer? For me it seems more appropriate asking the original asker. Commented Jan 22, 2020 at 11:20
  • @RuiFRibeiro your answer will replace all variables (not only specific variables). all patterns like $varname will be evaluated (not only the variables you're targetting). Commented Feb 26, 2020 at 12:31
  • 8
    @Craig There is no "below" on stack overflow - answers change order depending on various factors. Please link to the actual answer. Commented May 25, 2022 at 14:17
  • 2
    This is not the correct answer. This will lead to any undefined vriable being replaced with an empty string. The correct answer is by @don_crissti Commented Jan 30, 2024 at 19:26