friend_of_satan, (edited )

That’s not how it works. The second bare double-quote closes the first one regardless of how it is nested in a string. The middle pair of double-quotes would need to be escaped. Also, single-quotes cannot be escaped in this way.

The only place I can think of where nested double quotes do work is in subshells


<span style="color:#323232;">echo "hello $(echo "world")"
</span>

This is because the subshell is interpreted before the outer logic, so during interpretation of the outer logic there is never a nested double quote, just the stdout of the subshell.

These things are sometimes difficult to grok, and even more common, difficult to spot with human eyes. Best to use shellcheck, which will surely help you get better at shell scripting.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #