你提到的 fetchlinux 在 Linux 里并不是一个标准命令,常见情况有两种可能:
fetch(如 FreeBSD 的 fetch)在 Linux 上的替代下面我分别说明,你可以对号入座。
Linux 下一般用:
curl#!/bin/bash
url="https://example.com/file.tar.gz"
output="file.tar.gz"
curl -fSL "$url" -o "$output"
wget#!/bin/bash
url="https://example.com/file.tar.gz"
wget -O file.tar.gz "$url"
if command -v fetch >/dev/null 2>&1; then
fetch https://example.com/file.tar.gz
elif command -v curl >/dev/null 2>&1; then
curl -fSL https://example.com/file.tar.gz -o file.tar.gz
else
wget https://example.com/file.tar.gz
fi
fetchlinux 的命令which fetchlinux
type fetchlinux
#!/bin/bash
fetchlinux <参数>
如果不在 PATH 中:
/path/to/fetchlinux arg1 arg2
例如 neofetch / screenfetch:
#!/bin/bash
neofetch
或
screenfetch
| 你的需求 | 推荐方式 |
|---|---|
| 脚本下载文件 | curl / wget |
| 兼容 FreeBSD fetch | 判断命令存在 |
| 调用自定义 fetchlinux | 直接执行或写绝对路径 |
| 显示 Linux 信息 | neofetch |
如果你能贴一下:
fetchlinux 的来源(GitHub / 自己写的 / 某个教程)我可以给你精准脚本示例。