Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个库文件,其中有一个别名:
$ cat mylib.sh alias mal='ls -l' $cat test.sh #!/bin/bash source mylib.sh mal $./test.sh ./test.sh: line 3: mal: command not found
有什么想法吗?
要在非交互式 shell 中执行别名,请使用
shopt -s expand_aliases
您可能想要使用函数:
mal() { ls -l } mal