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*

3
  • Can't reproduce your error. But try quoting your assignements: var5="${var4/var1/$var1}" as well as echo "$var5". Commented Nov 22, 2019 at 15:30
  • Your third substitution should be var5=${var5/var3/$var3} and if you want to keep the single quotes in myfunction('var1','var2','var3'), you should define var4 using var4="myfunction('var1','var2','var3')". But I can't see a reason why the output should be jumbled. Commented Nov 22, 2019 at 15:30
  • 1
    That's not the output of that script. First of all, you're never replacing var3, but var1 twice. Second, your var4 does not have any single quotes within it, but somehow the output has them anyway. Please post the exact script you use when asking for help online, the details matter. Commented Nov 22, 2019 at 16:15