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



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