$HISTCHARS  –  Definition of History Expansion and Comment Parsing (Deprecated)

$HISTCHARS defines how the Zsh shell handles history expansion and how it parses line comments. This variable is deprecated, the lowercase $histchars should be used instead.

The value contains three ASCII characters:

  1. Character for a history expansion. Default: !.
  2. Character for a quick history substitution. Default: ^.
  3. Character to start a line comment. Default: #.

Examples

Change line comment character for a script
1
2
3
4
5
#!/usr/bin/env zsh
# Tell Zsh that underscore _ now start a line comment
HISTCHARS[3]='_'
_ new line comment
echo hello world
Output:
1
hello world
BashSupport Pro 是一款支持 HISTCHARS** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款