简体   繁体   English

为什么文件夹中的文件之间的符号链接相同?

[英]Why have symbolic links between files in folders at same depth?

I noticed that on OS X, the /usr/local/Cellar folder contains binaries installed using Homebrew, and that /usr/local/opt has symbolic links to a bunch of those binaries. 我注意到在OS X上, /usr/local/Cellar文件夹包含使用Homebrew安装的二进制文件,而/usr/local/opt包含指向这些二进制文件的符号链接。 I haven't used symbolic links much, but as I understand it, the purpose of them is to create a link in a convenient location to a file/folder that acts as a copy of that file/folder, without having to move that file/folder from its original location. 我没有多少使用过符号链接,但据我所知,它们的目的是在一个方便的位置创建一个链接到一个文件/文件夹,作为该文件/文件夹的副本,而不必移动该文件/文件夹从其原始位置。

So my questions are : 所以我的问题是

1) Am I correct in my understanding of symbolic links there? 1)我对符号链接的理解是否正确? ^^ ^^

2) If so ^^, why would you create symbolic links in one folder ( /usr/local/opt ) to binaries in another folder ( /usr/local/Cellar ) that is at a similar location/depth in the file structure? 2)如果是这样^^,为什么要在一个文件夹( /usr/local/opt )中创建符号链接到另一个文件夹( /usr/local/Cellar )中的二进制文件,该文件夹位于文件结构中类似的位置/深度? Under what circumstances would you use these symbolic links where you couldn't just use the binaries? 在什么情况下你会使用这些符号链接,你不能只使用二进制文件?

Thanks! 谢谢!

Homebrew wants to keep things organized, therefore installing all its packages in one place (the cellar). Homebrew希望保持井井有条,因此将所有包裹安装在一个地方(地窖)。 Certain files of the tools you install with Homebrew are expected to be in certain places (eg in /usr/local/opt ). 您使用Homebrew安装的工具的某些文件应该位于某些位置(例如/usr/local/opt )。 A symbolic link is used here so when you update the Homebrew package in the cellar, the files linked in /usr/local/opt are also referring to the same updated version. 这里使用符号链接,因此当您更新地窖中的Homebrew包时, /usr/local/opt中链接的文件也指相同的更新版本。

Also see the Homebrew FAQ for some info on the cellar 有关酒窖的一些信息,请参阅Homebrew常见问题解答

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

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