Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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'

share|improve this question
add comment

1 Answer

up vote 20 down vote accepted

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.

share|improve this answer
4  
This was "set -k" on my machine. –  Bruce Ediger Mar 12 '12 at 11:57
    
Thanks, "set -k" and "setopt interactivecomments" both work. –  Not Now Mar 12 '12 at 17:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.