Read-only diagnostics for your shell PATH and the rc files that build it.
validate-path.sh— checks every directory in the current$PATH; reports existing, missing, and empty (::) entries.analyze-path-bash.sh— parses your shell rc files (.zshrc,.bashrc,.bash_profile,.profile, etc.), followssource/.directives, records eachPATH=modification with file and line number, and reports duplicate entries.analyze-path-bash-2.sh— a more detailed variant that tracks per-entry source attributions and computes two views of the final PATH (array and string).
All three target Bash 4+ and are pure-diagnostics — they never modify your environment or any file on disk.
Clone or download the repo, then run each script directly from disk. Do not pipe these into a shell from the network — they are not distributed through the installer and ship with no checksum file; running unverified remote code is against this repo's ai_docs/REQUIREMENTS.md §3.
git clone https://github.com/descoped/script-utils.git
cd script-utils/validate-path
# Validate the current PATH
bash validate-path.sh
# Trace how PATH is built from rc files
bash analyze-path-bash.sh
bash analyze-path-bash.sh -v # verbose
# Alternate analyzer with per-entry source tracking
bash analyze-path-bash-2.sh
bash analyze-path-bash-2.sh -v
bash analyze-path-bash-2.sh -h # help
bash analyze-path-bash-2.sh ~/.zshrc # limit to specific filesvalidate-path.sh prints one line per entry:
/usr/local/bin exists
/opt/homebrew/bin does not exist
Empty (::) path exists
analyze-path-bash.sh and analyze-path-bash-2.sh print per-file trace logs with [INFO] / [WARNING] / [VERBOSE] prefixes, then a summary section listing the computed PATH and any duplicates.
- Security — empty
::entries resolve to the current directory, a classic privilege-escalation vector. - Troubleshooting — locate the rc file responsible for
command not foundor for an unexpected binary winning on$PATH. - Cleanup — identify duplicate or redundant entries accumulated across shell startup files.