我已经开发了一个functions文件夹,并将其加载到脚本中。
. /volume1/homes/David/functions/*
然后在同一脚本中,我在find命令中使用了子脚本,并且我想使功能在子脚本中可见:
find ${source_path} -type f -name "*.${ext}" -exec sh -c '
code ...
' {} ${dest_path} \;
您如何进行?
谢谢。
David
您可以使用export -f
导出bash中的函数,因此它们在子shell中可见。