#!/bin/bash # 检查参数 if [ $# -ne 1 ]; then echo "用法: $0 <文件名(不带扩展名)>" exit 1 fi filename="$1" upper_filename=$(echo "$filename" | tr '[:lower:]' '[:upper:]') # 创建目录(如果不存在) mkdir -p ./include/solution ./src ./tests # 创建 ./include/solution/a.h cat > ./include/solution/"$filename".h < ./src/"$filename".c < EOF # 创建 ./tests/test_a.cpp cat > ./tests/test_"$filename".cpp < #include EOF