shopt-option

Bash checkhash

Verify that a remembered executable path exists before attempting execution; search again if absent.

Formal Syntax & Structure

bash syntaxbash
shopt -s checkhash

Return Value

exit status

Verify that a remembered executable path exists before attempting execution; search again if absent.

Working Example

Example Snippetbash
mkdir a bprintf '#!/bin/bash\nprintf "first\\n"\n' > a/bm_probeprintf '#!/bin/bash\nprintf "second\\n"\n' > b/bm_probechmod +x a/bm_probe b/bm_probePATH="$PWD/a:$PWD/b:$PATH"hash bm_probebm_probemv a/bm_probe a/retiredshopt -s checkhashbm_probe
Bash Reference