的plugins文件夹中,可以使用以下代码实现:

#!/bin/bash

# 获取脚本名和目录路径
script_name=$(basename "$0")
script_dir=$(cd "$(dirname "$0")" && pwd)

# 搜索其他脚本安装位置
search_dir="/home/user/scripts"
find "$search_dir" -name "*.sh" -not -name "$script_name" -print0 |
while IFS= read -r -d '' script_path; do
  # 将找到的脚本复制到本脚本的plugins文件夹中
  cp "$script_path" "$script_dir/plugins/"
done

这段脚本会在指定的search_dir目录中搜索所有扩展名为.sh的脚本文件(不包括本脚本),并将它们复制到本脚本的plugins文件夹中。你可以将这段代码添加到你的Linux脚本中,以实现自动搜索并添加其他脚本的功能。

~foxbotYunzai-Bot一定有plugins文件夹是白狐脚本放机器人文件的地方现在我的Linux脚本要增加一个功能 搜索其他脚本安装位置 并添加至本脚本

原文地址: https://www.cveoy.top/t/topic/hu5C 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录