简体   繁体   English

在Mac上〜/ bin与/ usr / local / bin之间的区别

[英]difference between ~/bin vs /usr/local/bin on mac

I have a few exec scripts that I want to run on my command line. 我有一些要在命令行上运行的exec脚本。

Which folder should I place them in ~/bin or /usr/local/bin ? 我应该将它们放在~/bin/usr/local/bin哪个文件夹中?

What is the difference between both of these folders? 这两个文件夹有什么区别?

Which is the be used when? 什么时候使用?

Use ~/bin (or some similar location inside your home directory) if you want the scripts to be available only to your user account (not other user accounts, including root). 如果您希望脚本仅对您的用户帐户(而不是其他用户帐户,包括root)可用,请使用〜/ bin(或主目录中的某个类似位置)。 Essentially, this'd be your personal bin folder where you can do whatever you want without disturbing other users. 本质上,这将是您的个人bin文件夹,您可以在其中进行任何所需的操作而不会打扰其他用户。 You'll also have to add this to your PATH (in ~/.bash_profile, ~/.profile, or whatever). 您还必须将其添加到您的PATH中(在〜/ .bash_profile,〜/ .profile或任何其他文件中)。

If you want the scripts to be available under all user accounts OR don't have any other user accounts OR just don't care, use /usr/local/bin instead. 如果希望脚本在所有用户帐户下都可用,或者没有其他用户帐户,或者只是不在乎,请改用/ usr / local / bin。 This'll save the hassle of editing your PATH, and is generally a more standard location. 这将省去编辑PATH的麻烦,并且通常是更标准的位置。

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

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