I want to use some aliases in a non-interactive shell, after reading this post and this post. Here is my command:
bash -O expand_aliases -c 'source ~/.bashrc; <some alias>'
and here is my .bashrc:
# Bash History
HISTSIZE=1000
HISTFILESIZE=2000
# Colorful Prompt
PS1='\[\033[01;34m\]\w\n\[\033[01;32m\]\u@\h\[\033[00m\] > '
# Aliases
alias ls='ls --color=auto -A -I NTUSER.\* -I ntuser.\*'
alias echo='echo -e'
alias docker='"/mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe"'
alias docker-compose='"/mnt/c/Program Files/Docker/Docker/resources/bin/docker-compose.exe"'
I echoed something in .bashrc and am sure that source ~/.bashrc worked, but the aliases just refused to expand. I also tried:
bash -O expand_aliases -c shopt
to ensure that the option expand_aliases is set to on.
How do I fix this?