Wget
wget content-disposition ubuntu vs alpine
在 Ubuntu 中,我可以使用以下 wget 標誌來獲取 debian,即
wget --content-disposition https://packagecloud.io/xxxxx/download.deb dpkg -i ...
在 Alpine 中,wget 抱怨
--content-disposition
無效:wget: unrecognized option: content-disposition BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary. Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE] [--header 'header: value'] [-Y|--proxy on/off] [-P DIR] [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL... Retrieve files via HTTP or FTP --spider Only check URL existence: $? is 0 if exists -c Continue retrieval of aborted transfer -q Quiet -P DIR Save to DIR (default .) -S Show server response -T SEC Network read timeout is SEC seconds -O FILE Save to FILE ('-' for stdout) -U STR Use STR for User-Agent header -Y on/off Use proxy
在 alpine 中,我需要下載不同的“wget”嗎?
在 Alpine Linux 中,很多常用的 shell 工具都被 BusyBox 所取代。通過檢查以下命令的輸出,您可以看到 wget 的情況:
ls -lah $(which wget)
在我面前的 Alpine 安裝中,這是一個符號連結
/bin/busybox
在 BusyBox 中,
wget
沒有選項--content-disposition
:# wget --help BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary. Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE] [--header 'header: value'] [-Y|--proxy on/off] [-P DIR] [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL... Retrieve files via HTTP or FTP --spider Only check URL existence: $? is 0 if exists -c Continue retrieval of aborted transfer -q Quiet -P DIR Save to DIR (default .) -S Show server response -T SEC Network read timeout is SEC seconds -O FILE Save to FILE ('-' for stdout) -U STR Use STR for User-Agent header -Y on/off Use proxy
您還會發現 GNU
wget
在官方 Alpine 儲存庫中可用,因此要獲得完整版本,只需:apk update apk add wget
然後你安裝了 GNU
wget
,它的行為應該更像你用過的其他系統:# wget --help | grep -A1 content-disposition --content-disposition honor the Content-Disposition header when choosing local file names (EXPERIMENTAL)