On 2024-06-12 10:46, Mark J. Reed wrote:

Which ties back into those expectations from other languages that Marc mentioned. It's important to remember that, unlike in those languages, quotation marks are not token delimiters in the shell. They don't terminate the current shell word (what other languages would just call a "string"); you can go in and out of quotes, switch kinds of quotes, etc. as often as you like within a single word.

So .*.'~undo-tree~' is still just one string, even though only part of it is in quotation marks.  The part in quotes is not subject to glob expansion; the part not in quotes is.

Pure curiosity, I have no problem to solve, but supposing you did want to break the string up, I suppose you'd have to use an array?  Then perhaps manipulate the elements/words as desired, then recombine?