当我想要在Unix中执行一些shell脚本(假设我在脚本所在的目录中),我只需要输入以下命令:
./someShellScript.sh
当我想要“源”它(例如,在当前shell中运行它,而不是在新shell中)时,我只需在相同的命令前面加上"."(或等效的"source"命令):
. ./someShellScript.sh
现在是比较棘手的部分。当我想要执行"多个" shell 脚本(假设所有后缀名为 .sh 的文件)在当前目录中,我输入以下命令:
find . -type f -name *.sh -exec {} \;
但是,我应该使用什么命令来在目录中“SOURCE”多个shell脚本呢?
到目前为止,我尝试了以下方法,但都没有成功:
find . -type f -name *.sh -exec . {} \;
但它只抛出了这个错误:
find: `.': Permission denied
Thanks.