使用函数而不是别名有什么缺点吗?

Is there any drawback to using functions instead of aliases?

Bash 函数比别名更通用。例如,they accept parameters.

采用全功能风格并完全删除别名是否有任何缺点,即使对于简单的情况也是如此?我可以想象,也许功能会占用更多资源,但没有数据支持。

还有其他理由保留我的一些别名吗?它们的语法更简单,更易于人类阅读,但除此之外?

注意:别名优先于函数。

以下 link 可能与函数开销有关,与别名相比似乎没有开销:3.6. Functions, Aliases, and the Environment

再次引用丹的话:"Shell functions are about as efficient as they can be. It is the approximate equivalent of sourcing a bash/bourne shell script save that no file I/O need be done as the function is already in memory. The shell functions are typically loaded from [.bashrc or .bash_profile] depending on whether you want them only in the initial shell or in subshells as well. Contrast this with running a shell script: Your shell forks, the child does an exec, potentially the path is searched, the kernel opens the file and examines enough bytes to determine how to run the file, in the case of a shell script a shell must be started with the name of the script as its argument, the shell then opens the file, reads it and executes the statements. Compared to a shell function, everything other than executing the statements can be considered unnecessary overhead."