对应的curl脚本在Bash中:
#!/bin/bash
echo "---- Fetch Image ----"
# Current time
t=$(date +"%Y_%m_%d_%H_%M_%S")
# Anime picture API
uri="https://t.alcy.cc/pc/"
# File name
filename="${t}.webp"
echo $filename
# Fetch the image using curl
curl -o $filename $uri
echo "---- Fetch Image ----"
这个脚本使用Bash获取当前时间,设置目标URL和文件名称,并使用curl命令下载文件。
• date +"%Y_%m_%d_%H_%M_%S" 获取当前时间并格式化为YYYY_MM_DD_HH_MM_SS样式。
• curl -o $filename $uri 下载文件并将其保存为$filename.
你可以将这个脚本保存为.sh文件,例如 fetch_image.sh,并通过以下方式运行:
bash fetch_image.sh
确保你有执行该脚本的权限。你可以通过以下命令赋予权限:
chmod +x fetch_image.sh
Requesting $CSB funds from the Faucet on the #Crossbell blockchain. Address: 0x33e3aFE15ac7E772cf75f2545b00565533c2cE07. https://faucet.crossbell.io/
在我的区块链博客发布了一篇新文章《我是如何使用huginn的——同步youtube点赞到discord》,快来看看吧! https://lotosbin.xlog.app/wo-shi-ru-he-shi-yong-huginn-de--tong-bu-youtube-dian-zan-dao-discord 来自 @_xLog
在我的区块链博客发布了一篇新文章《# Android Dev Tip #2023-05-04》,快来看看吧! https://lotosbin.xlog.app/-Android-Dev-Tip-2023-05-04 来自 @_xLog