41

In bash, if I type a command beginning with a '#', bash ignores it as a comment.

Ie, the following is ignored at the bash prompt:

> # Hi there!

Whereas in zsh:

> # Hi there !
zsh: bad pattern: #

How can I ask zsh to do the same?

This is incredibly useful to "store" commands that you want to run later, or to chat when using a shared tmux/screen session.

I am using 'oh my zsh'

0

1 Answer 1

47

Check if the INTERACTIVE_COMMENTS option is set.

According to this page, "[...] in interactive shells with the INTERACTIVE_COMMENTS option set, [...] # causes that word and all the following characters up to a newline to be ignored."


According to the comments were added later, set -k does exactly the same thing.

3

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