Unix:更改 .profile 文件
我正在运行 MAC OS X。
我向我的 .profile 添加了一个新别名。现在,当我打开终端窗口时,我收到一条消息,指出找不到别名。我是否必须进行某种导出才能使我的 .profile 更改生效?
根据要求,我的.profile。
export PATH=$PATH:/opt/local/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib
alias sl='ls'
alias pwd='echo -n `pwd` | pbcopy'
I am running MAC OS X.
I added a new alias to my .profile. Now, when I open a terminal window, I get a message saying that the alias cannot be found. Do I have to do some sort of exporting to get the change to my .profile to take affect?
As requested, my .profile.
export PATH=$PATH:/opt/local/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib
alias sl='ls'
alias pwd='echo -n `pwd` | pbcopy'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要获取您的个人资料:
source .profile
You need to source your profile:
source .profile
您是否检查过您使用的是
bash
(或ksh
),它读取.profile
而不是tcsh
(默认值) MacOS X 上的 shell)不读取.profile
?您的配置文件中的其他命令是否被执行?
别名不起作用的是:
存在的问题是:
执行时执行了什么命令 -- 哎呀;这是别名吗?尝试:
我们还可以认为您可以只使用:
Have you checked that you are using
bash
(orksh
) which reads.profile
and nottcsh
(the default shell on MacOS X) which does not read.profile
?Do any other commands in your profile get executed?
The alias not working is:
The issue there is: what command is executed when the
is executed -- oops; it's the alias? Try:
We could also argue that you can use just:
如果您运行的是 leopard 或 Snow leopard,那么您应该将别名放入 .bash_login,而不是 .profile。
当然,前提是您使用的是 bash,我相信 Mac OS X 默认情况下就是这样做的。
If you're running leopard or snow leopard then you should put the alias into .bash_login, not .profile.
That's if you're using bash of course, which Mac OS X does by default I believe.