Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
bug report: INTERACTIVECOMMENTS option interacts oddly with shell functions in an interactive context
- X-seq: zsh-workers 49328
- From: Glyph <glyph@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: bug report: INTERACTIVECOMMENTS option interacts oddly with shell functions in an interactive context
- Date: Sun, 29 Aug 2021 13:55:46 -0700
- Archived-at: <https://zsh.org/workers/49328>
- List-id: <zsh-workers.zsh.org>
If we have a shell file like this, designed to be sourced:
#!/bin/zsh
function sample_function () {
(
setopt INTERACTIVECOMMENTS;
# interactive comment test
local bogus="$(
# test comment
echo "sample value";
)";
echo "${NOTSET:-${bogus}}";
)
}
Comments in sample_function are interpreted normally, but comments *inside* the "bogus" expression will be interpreted as executing in an interactive context, and will therefore cause errors if INTERACTIVECOMMENTS is not set, if the overall shell is interactive.
Thanks,
-g
Messages sorted by:
Reverse Date,
Date,
Thread,
Author