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

Re: $var not expanded in ${x?$var}



Stephane Chazelas wrote on Fri, 13 Jan 2023 08:02 +00:00:
> $ zsh -c 'echo ${1?$USERNAME}'
> zsh:1: 1: $USERNAME
>
> No quote removal either:
>
> $ zsh -c 'echo ${1?"x"}'
> zsh:1: 1: "x"
>

Thanks for the report.

> (also note that line number being printed twice)

No, it's not.  The second "1" is the parameter name:

$ zsh -fc 'echo ${foo?$USERNAME}' 
zsh:1: foo: $USERNAME

Cheers,

Daniel




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