#!/bin/bash # 目标目录 TARGET_DIR="/usr/lib/aarch64-linux-gnu" # 遍历所有 .so.4.2.0 文件并创建相应的符号链接 for file in ${TARGET_DIR}/libopencv_*.so.4.2.0; do base_name=$(basename ${file} .4.2.0) # 创建 .so.4.2 的符号链接 if [ ! -L "${TARGET_DIR}/${base_name}.4.2" ]; then ln -s ${file} ${TARGET_DIR}/${base_name}.4.2 echo "Created link: ${TARGET_DIR}/${base_name}.4.2 -> ${file}" fi # 创建 .so 的符号链接 if [ ! -L "${TARGET_DIR}/${base_name}" ]; then ln -s ${base_name}.4.2 ${TARGET_DIR}/${base_name} echo "Created link: ${TARGET_DIR}/${base_name} -> ${TARGET_DIR}/${base_name}.4.2" fi done