set-option

Bash set -o hashall

Controls automatic remembering of command paths. Disable to avoid automatic caching, not to establish executable trust. Clear prior entries with hash -r before comparing behavior. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): cached; not cached.

Formal Syntax & Structure

bash syntaxbash
set -o hashall; set +o hashall

Return Value

exit status

Option-setting command returns zero for a valid request; query status is zero if enabled, one if disabled.

Working Example

Example Snippetbash
set -o hashallhash -r/usr/bin/truecat /dev/nullhash -t cat >/dev/null || exit 1printf 'cached\n'hash -rset +o hashallcat /dev/nullset -o hashallif hash -t cat 2>/dev/null; then exit 1; fiprintf 'not cached\n'
Bash Reference