zsh-users
 help / color / mirror / code / Atom feed
* quoting question
@ 2023-09-12 18:45 Jim
  2023-09-12 20:06 ` Bart Schaefer
  2023-09-12 20:07 ` Peter Stephenson
  0 siblings, 2 replies; 13+ messages in thread
From: Jim @ 2023-09-12 18:45 UTC (permalink / raw)
  To: zsh


[-- Attachment #1.1: Type: text/plain, Size: 808 bytes --]

Hi everyone,

Zsh quoting at times makes me wonder. Do quoting? Don't do quoting?
The following case has me scratching my head.  Can someone explain what is
going on?

datetimetest ()
{
  local     DT
  DT="${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}"
  print $DT
  DT=${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}
  print $DT
  print -- "${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}"
  print -- ${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}
  print -- "Date and Time:  ${(%):-%D{%Y-%m-%d %H:%M:%S %Z}} Test"
}

Output:

2023-09-12 13:21:40 CDT}    <--  why "}" when quoted
2023-09-12 13:21:40 CDT
2023-09-12 13:21:40 CDT}    <--  why "}" when quoted
2023-09-12 13:21:40 CDT
Date and Time:  2023-09-12 13:21:40 CDT} Test    <--  why "}" when quoted

ZSH_PATCHLEVEL:  zsh-5.9-208-gf80ad32

Also included test function in an attachment.

Regards,

Jim Murphy

[-- Attachment #1.2: Type: text/html, Size: 1202 bytes --]

[-- Attachment #2: datetimetest.txt --]
[-- Type: text/plain, Size: 294 bytes --]

datetimetest ()
{
  local     DT
  DT="${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}"
  print $DT
  DT=${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}
  print $DT
  print -- "${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}"
  print -- ${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}
  print -- "Date and Time:  ${(%):-%D{%Y-%m-%d %H:%M:%S %Z}} Test"
}

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-09-13 16:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12 18:45 quoting question Jim
2023-09-12 20:06 ` Bart Schaefer
2023-09-13  2:50   ` Jim
2023-09-13  3:41     ` Bart Schaefer
2023-09-13 15:09       ` Debug zsh (was: Re: quoting question) Pier Paolo Grassi
2023-09-13 15:28         ` Mikael Magnusson
2023-09-13 11:28   ` quoting question Jim
2023-09-13 16:11     ` Bart Schaefer
2023-09-12 20:07 ` Peter Stephenson
2023-09-12 20:23   ` Bart Schaefer
2023-09-12 20:29     ` Bart Schaefer
2023-09-13  1:56       ` Mikael Magnusson
2023-09-13  8:50         ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).