简体   繁体   English

.bash_profile 和终端

[英].bash_profile and terminal

my .bash_profile looks this way :我的 .bash_profile 看起来像这样: 在此处输入图片说明

When I open my terminal I get this three lines :当我打开我的终端时,我得到这三行:

-bash: export: Workbooks.app/Contents/SharedSupport/path-bin': not a valid identifier -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': not a valid identifier -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': not a valid identifier -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': not a valid identifier -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': not a valid identifier -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': 不是一个有效的标识符 -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': not a valid identifier -bash: export: Workbooks.app/Contents/SharedSupport/path-bin': 不是一个有效的标识符

What should I remove from my .bash_profile to get rid of this ?我应该从我的 .bash_profile 中删除什么来摆脱这个?

在此处输入图片说明

There are multiple errors here, but the one you are asking about is because the space in Xamarin Workbooks needs to be escaped or quoted.这里有多个错误,但您要问的是因为Xamarin Workbooks的空间需要转义或引用。 See alsoWhen to wrap quotes around a shell variable?另请参阅何时在 shell 变量周围加上引号?

The repeated fragments are certainly erroneous as well;重复的片段当然也是错误的; the repeated code should only be present once.重复的代码应该只出现一次。 I'm guessing you ran some buggy installer multiple times, and it blindly added stuff which contained errors in the first place, and definitely should not be added again if it was already present.我猜你多次运行了一些有问题的安装程序,它首先盲目地添加了包含错误的东西,如果它已经存在,绝对不应该再次添加。 If you can identify this installer, maybe submit a bug report to its maintainer.如果您可以识别此安装程序,则可以向其维护者提交错误报告。

Hardcoding a complex PATH is also usually wrong.对复杂的PATH硬编码通常也是错误的。 Generally, the correct behavior is to preserve your previous PATH , and only add a single additional directory before or after the old value, like通常,正确的行为是保留以前的PATH ,并且只在旧值之前或之后添加一个附加目录,例如

PATH=/new/stuff:$PATH

or或者

PATH=$PATH:/new/stuff

where /new/stuff is the added directory, and $PATH recalls the variable's previous value.其中/new/stuff是添加的目录, $PATH调用变量的先前值。

If something blindly overrides your locale settings programmatically, that's also a bug, and outright hostile if your real locale settings were correct and useful.如果某些东西以编程方式盲目覆盖您的语言环境设置,这也是一个错误,并且如果您的真实语言环境设置正确且有用,则完全是敌对的。 Using LC_ALL is quite likely severe overkill in any event;无论如何,使用LC_ALL很可能是严重的矫枉过正; if a particular application requires you to override a particular locale setting, it should only override the specific one(s) it needs, not everything.如果特定应用程序要求您覆盖特定区域设置,则它应该只覆盖它需要的特定区域设置,而不是全部。 But really, even then, it has no business writing this stuff to your personal preferences.但实际上,即便如此,也没有必要根据您的个人喜好编写这些内容。

The Conda fragment also contains an example of poor practice (some would call it an antipattern); Conda 片段还包含一个糟糕实践的例子(有些人称之为反模式); see also Why is testing "$?"另请参阅为什么要测试“$”? to see if a command succeeded or not, an anti-pattern? 查看命令是否成功,反模式?

export PATH should not be necessary at all, though specifying it needlessly is harmless per se, and removes the assumption that the shell's system-wide startup files have already exported it. export PATH根本不需要,尽管不必要地指定它本身是无害的并且消除了 shell 的系统范围启动文件已经导出它的假设。 Exporting the same variable multiple times in the same script is just silly, though.不过,在同一个脚本中多次导出同一个变量是很愚蠢的。

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

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