问题描述
我在终端中读取并使用别名的.profile文件,但是在某些时候,别名无故停止工作(其他命令仍在工作).
I had a .profile file that I was reading and using aliases from in my terminal, but at some point the aliases stopped working for no clear reason (other commands were still working).
为了快速解决问题,我删除了(rm)并在用户目录中重新创建了.profile文件.我看不到bash_profiles或其他文件,至少在该目录中.
Thinking to make a quick fix, I deleted (rm) and recreated my .profile file in my user directory. There are no bash_profiles or others in existence that I can see, at leasts in that directory.
新的.profile不起作用.我尝试重新启动终端和计算机.
The new .profile did not work. I tried restarting the terminal and the computer.
现在,尽管我找不到该文件,但仍可以运行在原始.profile中使用的命令,而新的.profile提供了:
Now, the commands that worked in the original .profile are still run although I cannot find the file, and the new .profile gives:
没有这样的文件或目录(文件名的后半部分来自此处)和:找不到命令消息
No such file or directory(last half of a filename sourced here)and: command not found messages
.profile文件仅包含路径更新,别名和源文件.尝试获取.profile文件的源也给出了上面的错误消息.
The .profile file only contains path updates, aliases, and files to source.Trying to source the .profile file also gives the error messages above.
但是,在路径中键入更新,别名和文件,方法是从.profile文件中复制它们以直接将其来源到终端.
However, typing in the path updates, aliases, and files to source directly into the terminal by copying them from the .profile file works fine.
帮助?
推荐答案
也许您的主目录中有一个 .bash_profile
或 .bash-login
文件,优先阅读您的 .profile
设置?
Perhaps you have a .bash_profile
or .bash-login
file in your home directory and it's being read in preference to your .profile
settings?
在这里看看:如何使OS X读取.bash_profile而不是.profile文件
这篇关于.profile无法从Mac中的终端工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!