.bash_profile and terminal

北慕城南 提交于 2020-01-30 13:20:57

问题


my .bash_profile looks this way :

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

What should I remove from my .bash_profile to get rid of this ?


回答1:


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. See also When to wrap quotes around a shell variable?

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. 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=/new/stuff:$PATH

or

PATH=$PATH:/new/stuff

where /new/stuff is the added directory, and $PATH recalls the variable's previous value.

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; 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); 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. Exporting the same variable multiple times in the same script is just silly, though.



来源:https://stackoverflow.com/questions/59703586/bash-profile-and-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!