如何使用shell脚本的.bashrc中定义的别名

问题描述:

在〜/ .bashrc中,我定义了一些别名。但我不能在其他shell脚本,在这里我只能用定义在那里的别名使用它们。即使我采购的.bashrc,它仍然没有奏效。我应该怎么办?

In ~/.bashrc, I defined some aliases. But I cannot use them in other shell scripts, where I can only use aliases defined right there. Even though I sourced bashrc, it still did not work. What should I do?

PS。我在bash。

PS. I'm in bash.

您需要做的禁用了javascript -s expand_aliases 中除了脚本采购〜/ .bashrc中

You need to do shopt -s expand_aliases in the script in addition to sourcing ~/.bashrc.