#!/bin/bash function cd_dir { local dir_path=$1 # 检查目录是否存在 if [ ! -d "$dir_path" ]; then echo "Directory $dir_path does not exist. Creating..." mkdir -p "$dir_path" fi cd "$dir_path" || exit } cd_dir build cmake .. make -j8 sudo make install -j8 cd ..