Control History Expansion, Quick Substitution, and Tokenization

$histchars contains up to three characters:

  1. history expansion character: Defines the start of a history expansion. Default value: !.
  2. quick substitution character: The character, which starts a substitution, when it’s first on a line. Default value: ^.
  3. end-of-line comment character (optional): The character, where an end-of-line comment begins. Default value: #

Live Templates

Examples

Quick substitution to print hello world :

1
2
3
4
5
echo hello
# here comes the quick substitution 
# to replace "hello" of the previous 
# command with "hello world" and run it 
^hello^hello\ world^

Now use a custom substitution character :

1
2
3
histchars='!@'
echo hello
@hello@hello\ world@
BashSupport Pro is a Bash IDE with support for $histchars – try it now!
© 2020–2022 Joachim Ansorg
Imprint
Privacy Policy
Legal