开发者

Unix: making change to .profile file

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'


You need to source your profile:

source .profile


Have you checked that you are using bash (or ksh) which reads .profile and not tcsh (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:

alias pwd='echo -n `pwd` | pbcopy'

The issue there is: what command is executed when the

`pwd`

is executed -- oops; it's the alias? Try:

alias pwd='echo -n $(/bin/pwd) | pbcopy'

We could also argue that you can use just:

alias pwd='/bin/pwd | pbcopy'


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜