简体   繁体   English

通过bash脚本安装软件包

[英]Installing packages through bash scripting

I have never written any bash scripts at this point and my understanding of them is still pretty green. 我到目前为止还没有写过任何bash脚本,而我对它们的理解仍然是绿色的。 I was curious after reformatting my Mac if it is possible to write a script that does the majority of installs in an automated fashion? 重新格式化Mac后,我是否很好奇,是否可以编写一个脚本来自动执行大多数安装?

For instance I use homebrew so maybe a portion of the script could verify if this is on the Mac and if not then initiate the install. 例如,我使用homebrew因此脚本的一部分可能会验证它是否在Mac上,如果不是,则启动安装。 Then it could proceed with the list of brew install & brew cask installs . 然后可以继续进行brew installbrew cask installs列表。

This is something that after realizing how much I had installed and had to remember and still am remembering to install I think would be pretty cool to make...I just don't know if a) it's possible with the macOS or how-to (I'll read up on the how-to). 这是在意识到我已经安装并必须记住并且仍然记得要安装的东西之后,我认为制作起来会很酷...我只是不知道a)macOS或how-to是否可行(我将详细阅读操作方法)。 I'm not even too sure if bash-scripts would be the thing to use for something like this or not. 我什至不太确定bash脚本是否可以用于类似这样的事情。 Thanks in advance for any information! 在此先感谢您提供任何信息!

on an RPM based system I would eventually list the packages installed, backup the list and then chain it in a yum install command. 在基于RPM的系统上,我最终将列出已安装的软件包,备份列表,然后将其链接到yum install命令中。

For instance: 例如:

yum list installed ABC 百胜榜装好ABC

then to reinstall 然后重新安装

yum install ABC -y 百胜安装ABC -y

Extremely easy and straight forward. 非常简单直接。

I do believe you can do the same with brew: 我相信您可以通过brew做同样的事情:

brew list brew install based on the list brew list根据列表进行brew安装

I hope this helps 我希望这有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM