$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 ist eine Zsh IDE mit Unterstützung für $HISTCHARS - probieren Sie es jetzt aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches