Hi!
I currently have a separate file with all my aliases and functions that I source via .bashrc. But would separate scripts be faster (in e.g. ~/bin)?
Functions are, as I understand, loaded into the RAM and because of that, functions are very fast. An other advantage is that functions is executed in the current shell, which can be handy in some cases. And on the other side, scripts are only loaded when you run them, but the computer have to read from the disk every time you call a new script. All functions are in the RAM from beginning, and the computer don't need to read from the disk. Scripts often starts with comments and #! to tell Bash what shell it should use. Functions in Bash always run in Bash, so there's no need to find out which shell the script want to use, nor start a new subshell to run the script in.
What do you prefer and what is the fastest and best way?
Bookmarks