要获取最新版本的 BleachBit(适用于 Ubuntu 20.04),我们可以使用以下命令:
wget -c https://download.bleachbit.org/bleachbit_4.4.0-0_all_ubuntu2004.deb -O bleachbit.deb
dpkg -i bleachbit.deb
如果我们从官方 Ubuntu 存储库(使用apt-get bleachbit
)安装它,则会安装旧版本,其中包含安装错误。并且根据此工具的创建者:
Ubuntu 有一个“不滚动发布”政策,因此 Ubuntu 存储库不会更新最新版本
由于此工具会定期更新,因此我希望始终下载最新版本。因此我执行了这个 bash,但它不起作用:
lastbleachbit=$(wget -O - https://www.bleachbit.org/download/ | grep -Po '/download/file/([^"]+)' | grep ubuntu2004 | sort -u)
wget -c https://www.bleachbit.org"$lastbleachbit" -O bleachbit.deb
dpkg -i bleachbit.deb
输出变量:
lastmintstick=$(wget -O - http://packages.linuxmint.com/pool/main/m/mintstick/ | grep -Po 'href=".*?"' | sed -r 's:href\="(.*)":\1:' | grep ".deb" | sort | tail -1)
--2021-11-10 10:24:50-- http://packages.linuxmint.com/pool/main/m/mintstick/
Resolviendo packages.linuxmint.com (packages.linuxmint.com)... 208.77.20.11, 68.235.39.11
Conectando con packages.linuxmint.com (packages.linuxmint.com)[208.77.20.11]:80... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: 10112 (9,9K) [text/html]
Guardando como: “STDOUT”
- 100%[===================>] 9,88K --.-KB/s en 0s
2021-11-10 10:24:51 (191 MB/s) - escritos a stdout [10112/10112]
输出命令:
wget -c https://www.bleachbit.org"$lastbleachbit"
--2021-11-10 10:26:39-- https://www.bleachbit.org/
Resolviendo www.bleachbit.org (www.bleachbit.org)... 172.67.129.101, 104.21.1.137, 2606:4700:3030::ac43:8165, ...
Conectando con www.bleachbit.org (www.bleachbit.org)[172.67.129.101]:443... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: no especificado [text/html]
Guardando como: “index.html”
index.html [ <=> ] 10,93K --.-KB/s en 0,002s
2021-11-10 10:26:40 (4,38 MB/s) - “index.html” guardado [11193]
我做错了什么?
答案1
你失踪了/linux
。
$ lastbleachbit=$(wget --quiet -O - https://www.bleachbit.org/download/linux | grep -Po '/download/file/([^"]+)' | grep ubuntu2004 | sort -u)
$ echo $lastbleachbit
/download/file/t?file=bleachbit_4.4.0-0_all_ubuntu2004.deb
凭借我有限的 grep 知识,我设法让它工作起来。
$ lastbleachbit=$(wget --quiet -O - https://www.bleachbit.org/download/linux | grep -Po '(?<=file=).*(?=">)' | grep ubuntu2004 | sort -u)
$ echo $lastbleachbit
bleachbit_4.4.0-0_all_ubuntu2004.deb
当你下载它时。
$ wget "https://download.bleachbit.org/${lastbleachbit}"
--2021-11-10 16:01:10-- https://download.bleachbit.org/bleachbit_4.4.0-0_all_ubuntu2004.deb
Resolving download.bleachbit.org (download.bleachbit.org)... 172.67.129.101, 104.21.1.137, 2606:4700:3035::6815:189, ...
Connecting to download.bleachbit.org (download.bleachbit.org)|172.67.129.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 441432 (431K) [application/x-deb]
Saving to: ‘bleachbit_4.4.0-0_all_ubuntu2004.deb’
bleachbit_4.4.0-0_all_ubuntu2004. 100%[===========================================================>] 431.09K 2.02MB/s in 0.2s
2021-11-10 16:01:11 (2.02 MB/s) - ‘bleachbit_4.4.0-0_all_ubuntu2004.deb’ saved [441432/441432]
我认为只要下载页面继续嵌入包含.deb
文件的链接,这应该有效,但我不知道能持续多久,因为我从未使用过 bleachbit。