I use clipmenu to choose something to paste into terminal that running zsh as shell.

Problem is that zsh will echo error when for example I paste a shell function that contains some # for comments inside that function. I have to manually go back and clear all lines contain #.

System: archlinux/zsh/clipmenu

EDIT: example of function:

test() {
    # must remove this line manually after paste into zsh's shell
    <do something>
  • 1
    Could you give an example of such a function?
    – Kusalananda
    Dec 20, 2018 at 10:40
  • @Kusalananda: Thanks, I've just added one. Dec 20, 2018 at 11:07
  • It might help future searchers if you included the zsh error, presumably zsh: command not found: #
    – Jeff Schaller
    Dec 20, 2018 at 17:52
  • @JeffSchaller, the error would only be upon running the function (though in the specific OP's example, there's also a problem with the unmatched single quote), and you'd get a command not found or bad pattern depending on whether the extendedglob option is set or not. Dec 23, 2018 at 11:03
  • See unix.stackexchange.com/q/557486/5132 for example.
    – JdeBP
    Dec 31, 2019 at 8:42

1 Answer 1


Perhaps you just need to setopt interactivecomments?


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .