Unix shell-加载从子脚本可见的函数

问题描述 投票:0回答:1

我已经开发了一个functions文件夹,并将其加载到脚本中。

. /volume1/homes/David/functions/*

然后在同一脚本中,我在find命令中使用了子脚本,并且我想使功能在子脚本中可见:

find ${source_path} -type f -name "*.${ext}" -exec sh -c '
code ...
'  {} ${dest_path} \;

您如何进行?

谢谢。

David

function shell unix subscript
1个回答
0
投票

您可以使用export -f导出bash中的函数,因此它们在子shell中可见。

© www.soinside.com 2019 - 2024. All rights reserved.