Created
October 13, 2024 15:38
-
-
Save ryancheley/69fa6b75023affd514ba3920477cffa4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Define the path to search for | |
| SEARCH_PATH="/usr/local/bin" | |
| # Define the files to search within | |
| FILES_TO_CHECK=( | |
| "$HOME/.bash_profile" | |
| "$HOME/.bashrc" | |
| "$HOME/.profile" | |
| "$HOME/.zshrc" | |
| "/etc/profile" | |
| "/etc/paths" | |
| "/etc/bash.bashrc" | |
| ) | |
| # Function to check each file | |
| check_file() { | |
| local file=$1 | |
| if [ -f "$file" ]; then | |
| echo "Checking $file for '$SEARCH_PATH' additions..." | |
| grep -H "$SEARCH_PATH" "$file" | grep PATH | |
| else | |
| echo "File $file does not exist." | |
| fi | |
| } | |
| # Loop through files and check them | |
| for file in "${FILES_TO_CHECK[@]}"; do | |
| check_file "$file" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment