$histchars  –  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: #

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 是一个 支持 $histchars 的 Bash 集成开发工具 – 马上试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款