This is a card in Dave's Virtual Box of Cards.

Shell startup files that echo their names as a prefix

Created: 2024-12-08

Back to unix and/or Shell startup files (.profile vs .*rc).

I’ve started prefixing all shell startup messages with the name of the file that is executing.

For example, my "final" iteration of the startup files for this ksh setup I’ve got on my OpenBSD server at home prints out messages like this:

.profile: Doing web-dev things...
.profile: Opening files.
.kshrc: Defining aliases.

It’s stupidly simple, but these files tell you what they’re doing. I can’t possibly forget what’s executing what.

There’s no magic involved, either. I’m literally just printing these messages like you see them:

echo ".kshrc: Defining aliases."

Next time I edit my local .bashrc and .bash_profile, I’m going to add message prefixes to them too.