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

Re: tilde syntax



On Thu, Jan 4, 2024, at 7:12 PM, Ray Andrews wrote:
> On 2024-01-04 15:40, Lawrence Velázquez wrote:
>> https://zsh.sourceforge.io/Doc/Release/Expansion.html#index-GLOB_005fSUBST_002c-toggle
> Thanks. 'Parameter Expansion' is what I need to remember.

Another important part occurs earlier in "Parameter Expansion" and
can admittedly be hard to find:

        ${name}

		[...]  In addition, more complicated forms of
		substitution usually require the braces to be
		present; exceptions, which only apply if the option
		KSH_ARRAYS is not set, are a single subscript or
		any colon modifiers appearing after the name, or
		any of the characters `^', `=', `~', `#' or `+'
		appearing before the name, all of which work with
		or without braces.

This is why you can use $~foo instead of ${~foo} sometimes.


> I need to understand this tilde better but that's enough for  now.  I 
> think 'further interpretation' 
>
> is going to be over my head for some time

That just refers to the result of the parameter expansion being
subsequently used as something other than a literal value, if the
context calls for it.


-- 
vq




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