In my dotfiles I have some functions that rely on aliases or functions to exist for them to work. For some reason, I can get them to reference other functions I have created, but not aliases for commands. How do I fix this?
Example:
function open-dotfiles-commit(){
xopen https://github.com/fatso83/dotfiles/blob/$1;
}
If I have an alias xopen
(alias xopen=xdg-open
), the open-dotfiles-commit
command will fail with xopen: cannot find command
. On the other hand, if I replace the alias definition with a function called xopen
(function xopen(){ xdg-open; };
) it works!
I have even tried setting shopt -s expand_aliases
in the same file as where I define the aliases - unsuccessfully. The alias and functions file is sourced by my .bashrc
.
~/.bashrc
and the alias file?eval
in front of your command.