0

Is there a way I can use bash aliases from my .bash_aliases file within a shell-scripts?

I thought of something like including source "$HOME/.bash_aliases into my script

but it does not work.

nath
  • 5,694
  • If you write your "aliases" as functions instead, they will work. Using "$HOME"/... will make things very user-specific. – David G. Mar 29 '24 at 11:41

1 Answers1

2

Non-interactive shells don't expand aliases by default. You need to enable it:

shopt -s expand_aliases
choroba
  • 47,233