我正在编写这样的更新脚本:
update.sh
#!/bin/bash
sudo echo
printf "### PACMAN\n" # I am running Arch Linux
sudo pacman -Syu
printf "\n### YAY\n"
yay -Syua
printf "\n### CUSTOM\n"
custom_script.sh # code below
custom_script.sh
#!/bin/bash
# [...]
wget --quiet --show-progress <some link>
# [...]
输出看起来像这样:
### PACMAN
<...>
:: Retrieving packages...
linux-lts-4.14.88-1-x86_64 60,8 MiB 725K/s 01:26 [########################################] 100%
<...>
### YAY
:: Searching AUR for updates...
there is nothing to do
### CUSTOM
:: Downloading custom updates...
somefile.txt 100%[================================================>] 20,92M 3,83MB/s in 5,6s
有没有办法让wget
命令以custom_script.sh
与进度条相同的方式格式化pacman
?我也可以使用curl
或其他一些下载工具。
期望的输出:
### PACMAN
<...>
:: Retrieving packages...
linux-lts-4.14.88-1-x86_64 60,8 MiB 725K/s 01:26 [########################################] 100%
<...>
### YAY
:: Searching AUR for updates...
there is nothing to do
### CUSTOM
:: Downloading custom updates...
somefile.txt 20,9 MiB 3,8M/s 00:05 [########################################] 100%