Why are aliases missing inside of bash command?
When I run in my terminal:
alias
a list with all my aliases (defined in `~/bashrc` and `~/.bash_aliases` files) will be displayed on my terminal. That's nice and as expected!
But when I run:
bash -c "alias"
there is no output, so no aliases. First I thought that `~/.bashrc` file is not sourced in the second case, so I ran:
bash -c ". ~/.bashrc && alias"
but, stupor, again there is no output...
Strangely enough, when I run:
bash -c ". ~/.bash_aliases && alias"
only the aliases defined in `~/.bash_aliases` will be displayed.
Can someone make some light and make me understand what exactly it is happening here?
You need an interactive shell for alias definitions: