Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: wrong error msg



On Mar 1,  6:20pm, Ray Andrews wrote:
} Subject: wrong error msg
}
} Probably not worth reporting but:
} 
}      echo "Restore \"${previous?\"? (y/n)"
} 
} in a script reports: " unmatched " " whereas it should be an unmatched 
} curly

The error message is correct.  Try it outside of a script and you can
see what's happening:

torch% echo "Restore \"${previous?\"? (y/n)"
dquote braceparam dquote> 

Note it's still waiting for you to close the inner quote, the brace,
and an outer quote.  If end-of-file is received there, the first
error (unwinding the stack right to left) is unmatched quote.  It
doesn't report the other two things that aren't matched.

This is because for example
  echo "Outer quote ${var:="inner quote"} outer again"
is valid syntax -- you can include nested double quotes inside ${...}.
The result might be a "bad substitution" depending on what else is or
isn't inside the braces but that doesn't affect parsing the quotes.



Messages sorted by: Reverse Date, Date, Thread, Author