I have quite a few simple functions that I had previously kept in my .profile but I decided to put them in Perl scripts and add aliases to the Perl scripts. I feel like this is a bad idea, but the functionality looks/is better in Perl than bash since it is fairly complex (involving floating point math etc.).
Are there any best practices for login scripts and/or functions that are being put in the PATH variable (concerning both security and system stability issues)? Do you distribute functionality outside of the login script for complex tasks, or do you have a monolithic login script?
I guess this can be distilled to just a question about the validity of login script refactoring, and if it’s valid how it’s usually done.
I personally have a scripts directory ~/.bin, add it to PATH in ~/.profile, and keep all my personal scripts in there. I have bashlib in there which is sourced by all my other scripts and by ~/.bashrc which contains all my convenience functions.
My ~/.profile contains only environment variables that I need defined (like PATH), and my ~/.bashrc contains shell initialization and a few functions/aliases that are too simplistic to put in the form of a script.
The links show you how I set up those files.
By the way, refer to http://mywiki.wooledge.org/DotFiles for a description of how exactly the shell initialization happens; and which types of things go in which files.