This commit is contained in:
2026-01-23 10:36:26 +08:00
commit 5271b32dd5
8 changed files with 224 additions and 0 deletions

44
download_links.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# 脚本用于读取readme.md文件中的链接并下载文件
# 使用方法: ./download_links.sh
# 检查readme.md文件是否存在
if [ ! -f "readme.md" ]; then
echo "错误: readme.md 文件不存在!"
exit 1
fi
# 提取所有https链接
echo "正在从readme.md中提取链接..."
links=$(grep -o 'https://[^ ]*' readme.md)
# 检查是否找到链接
if [ -z "$links" ]; then
echo "错误: 在readme.md中未找到任何链接!"
exit 1
fi
echo "找到以下链接:"
echo "$links"
echo ""
# 下载每个文件
count=0
for url in $links; do
# 从URL中提取文件名
filename=$(basename "$url")
echo "正在下载: $filename"
# 使用curl下载文件
if curl -s -o "$filename" "$url"; then
echo "✓ 下载成功: $filename"
count=$((count + 1))
else
echo "✗ 下载失败: $filename"
fi
done
echo ""
echo "下载完成! 成功下载了 $count 个文件。"