我是Linux的新手,因此需要了解有关此命令解释的详细信息。
sudo bash -c 'for i in update {,dist-}upgrade auto{remove,clean}; do apt-get $i -y; done'发布于 2018-10-22 05:51:53
该命令可细分为以下几个部分:
sudo:具有根权限bash -c '...':使用bash执行用单引号包装的命令,这是大多数linux发行版附带的标准shell。for i in update {,dist-}upgrade auto{remove,clean}; do ...; done:这是bash.The part update {,dist-}upgrade auto{remove,clean}中的for循环,实际上是一个元素为update, upgrade, dist-upgrade, autoremove, autoclean的数组,变量i将按照顺序接受每个值。您将在高级bash脚本指南中获得更多信息。apt-get $i -y:最终执行的是什么。i是循环变量。-y的意思是默认情况下回答是。您可以通过命令man apt-get找到更多信息。因此,这个命令基本上相当于以下命令-- sudo apt-get update -y sudo apt-get upgrade -y sudo apt-get dist-upgrade -y sudo apt-get autoremove -y sudo apt-get autoclean -y,这是对系统中软件的完全升级和清理。
https://stackoverflow.com/questions/52922985
复制相似问题