New user: bashrc error code

excellent. thank you!

Not quite. If you define alias sudo='sudo ' then when running sudo abc the word “abc” is also expanded as an alias. I you do not define the alias for sudo, then the word “abc” isn’t expanded even if it is a valid alias name.

See man bash and search for the section named “ALIASES”. It is complicated and bash is full of nasty details like that.

I expect that is probably, at least in part, because sudo actually changes the environment to obtain super user privileges. I have never encountered that situation since I do not use sudo with any of the aliases I have defined. (If the command within the alias requires sudo privileges then sudo is used within the alias definition and not while launching the alias.)

(post deleted by author)

It has nothing to do with sudo per se. You can do the same with any other alias, which is perhaps not useful, but you can do it.

sudo doesn’t change the environment of the current shell. It creates a new process with a new shell with a new environment.

It’s not a matter of personal preference. The names of the files in ~/.bashrc.d must not start with a dot, otherwise the glob expansion in ~/.bashrc will skip them: for rc in ~/.bashrc.d/*; do. Hidden files are not glob-expanded.