Apt

不確定組合 apt-get update 和 apt-get upgrade 的別名是否正常工作

  • July 9, 2020

以下是有問題的別名:

alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade'
alias upgrate='sudo apt-get update && sudo apt-get upgrade'

這是我執行更新時的輸出:

[Wed Jul 08 20:47] gsw @ MacWoody:~ $ update
[sudo] password for gsw: 
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease                              
Hit:3 http://deb.debian.org/debian buster-updates InRelease                      
Hit:4 https://dl.yarnpkg.com/debian stable InRelease                             
Ign:5 http://ppa.launchpad.net/djcj/screenfetch/ubuntu groovy InRelease          
Hit:6 http://repository.spotify.com stable InRelease
Err:7 http://ppa.launchpad.net/djcj/screenfetch/ubuntu groovy Release
 404  Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/djcj/screenfetch/ubuntu groovy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

這是我執行升級時的輸出:

[Wed Jul 08 20:47] gsw @ MacWoody:~ $ upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

這是我執行升級時的輸出,它應該結合兩個程序。在我看來,它好像沒有執行命令的升級部分,我不知道為什麼:

[Wed Jul 08 20:48] gsw @ MacWoody:~ $ upgrate
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 https://dl.yarnpkg.com/debian stable InRelease                             
Ign:3 http://ppa.launchpad.net/djcj/screenfetch/ubuntu groovy InRelease          
Hit:4 http://repository.spotify.com stable InRelease                
Hit:5 http://deb.debian.org/debian buster InRelease                      
Hit:6 http://deb.debian.org/debian buster-updates InRelease              
Err:7 http://ppa.launchpad.net/djcj/screenfetch/ubuntu groovy Release
 404  Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/djcj/screenfetch/ubuntu groovy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

根據 upgrate 的輸出,它看起來好像只是在更新儲存庫而不是繼續升級包。感謝您提供任何幫助或資訊,謝謝

&&意味著以下命令僅在前一個以 . 退出時才會執行0

鑑於apt-get update正在產生錯誤,它的返回程式碼不會0- 因此,apt-get upgrade不會被執行。

解決方法:

alias upgrate='sudo apt-get update; sudo apt-get upgrade'

引用自:https://unix.stackexchange.com/questions/597564