Commands Managed by hash

$BASH_CMDS is a key-value mapping of the commands managed by the hash builtin. Adding elements to it updated the hash table.

Examples

Update and print hash table:

1
2
3
4
hash -p /usr/local/bin/bash4.2 "myBash"
echo myBash=${BASH_CMDS["myBash"]}
# myBash is now available as command
# hash prints how many times it was used

Output: /usr/local/bin/bash4.2.

BashSupport Pro is a Bash IDE with support for $BASH_CMDS – try it now!
© 2020–2022 Joachim Ansorg
Imprint
Privacy Policy
Legal