I am only starting to learn about shell functions so I'm just hoping for some guidance from people who use them.
I have an embarrassingly long list of aliases in my
.shrc (and in my
.zshrc on my linux machine) and while I do also have some functions defined in both of these shell rc files, they were just copied from other on the internet.
I'd like to know what is the best way to manage my shell rc and reduce the number of aliases. While searching the web I read through An Introduction to the Z Shell which describes the use of functions using
builtin which sounds pretty clever. I then discovered that
From what I've read, it sounds like the cleanest solution is to create a
.ksh_functions folder that contains all of my shell functions use
autoload instead of defining each function in the shell rc file itself. This concept makes sense to me, but what I don't yet know how to do is turn each alias into an function which is then managed with
I guess I would ultimately be replacing my long list of aliases with a long list of these:
autoload $HOME/.ksh_functions/function-name ??
Does anyone here do this? Any pointers for a noob?
I suppose it's worth also mentioning that part of the reason I became interested in using functions is because it will enable me to pass arguments to these functions which is an an advantage over using aliases. I also considered using shell scripts instead, but I feel like running a script, which in-turn creates another process, every time I use some of my aliases would be a bit excessive.