Fix the Broken $PATH: Custom Commands No Longer Found After Login
The laborant user reports that the greet command from /opt/tools/bin was working
fine in a previous session, but after every new login the command is not found:
-bash: greet: command not found
The user remembers that /opt/tools/bin was added to $PATH somewhere in the shell
profile files. Something about that configuration is now broken.
Investigate the shell startup files on rocky-01, diagnose the exact problem, and fix it
so that /opt/tools/bin is correctly added to $PATH in every new login shell.
Hint 1 — Where to start
Shell startup files are loaded in a specific order depending on whether the shell is a
login shell or an interactive non-login shell. Start by looking at which files exist in
the laborant home directory and what they contain.
Hint 2 — Which file is responsible for login shells
On Rocky Linux (and RHEL), ~/.bash_profile is sourced by login shells.
~/.bashrc is sourced by interactive non-login shells. Check whether the PATH
export is in the right file.
Hint 3 — Look very carefully at the export line
Even if the export line is in the correct file, it may be syntactically valid Bash but
functionally broken. Read every character on the line that sets PATH. Shell
redirections (>, >>) appended to an export statement silently misdirect the
output — the variable is never actually set.