I have 2 separate files, which are both sourced from my
.zshrc, one of them (the first one) is defining this alias:
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
problem is that the other one, sourced after this one is also defining
alias wget='wget -c'
I need to somehow ensure, that the second alias defines itself using the previous alias.
I was thinking of using something like
$(wget), but that just gets me into a recursive loop.
Is there some good way to reference an already existing alias with the same name while defining a new one?
I was maybe thinking of somehow getting the content of the first alias and only concatenating that with my new flag so that it will build on the previous alias, I'd probably also have to do some handling to fall back to the real command if the command wasn't already aliased before.
Note: I know that I could just change the name of one of those aliases and reference it in the next one, but that's not what I'm asking for. Nor do I want to just simply define them as 1 alias manually. I want a way to actually automatically use the old alias definition when defining a new one, so that they get chained together .
Any idea how could I implement something like this? Or perhaps a better method to do something like this?