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*

30
  • In fact, you need to leave the quotes out in order for a variable to be parsed as an arithmetic expression. Why am I able to make your example work with quotes: echo "$(("$expr"))" Commented Nov 29, 2016 at 4:05
  • 9
    Also, for anyone who is interested, the formal names of split+glob are word splitting and pathname expansion. Commented Nov 29, 2016 at 4:21
  • 4
    FYI -- over on StackOverflow, I've had someone pull the "optional when a raw string is expected" language in this answer out to defend not quoting an argument to echo. It might be worth trying to make the language even more explicit ("when a raw string is expected by the parser", perhaps?) Commented Mar 10, 2017 at 4:01
  • 3
    @CharlesDuffy Ugh, I hadn't thought of this misreading. I've changed “where” to “when” and reinforced the sentence as you suggested. Commented Mar 10, 2017 at 11:04
  • 4
    Super answer. Just reinforcing what a mess it as and to... Quote unless you have a specific reason not to Commented Feb 19, 2021 at 7:32