Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am going through and old .cshrc file and it contains the following alias:

alias pwd 'echo $cwd'

How is that useful?

I used to think that this is how pwd might have been implemented. But looks like thats not the case (because then this alias is meaningless).

share|improve this question
    
Meta: I believe you should have added the word "pwd" to the question's title. –  esperanto Oct 3 '13 at 9:53

2 Answers 2

up vote 5 down vote accepted

http://www.sunmanagers.org/archives/1996/0273.html

This mailing list archive shows the subtle differences between the two that existed in 1996. Not sure if they still exist now, but since you mentioned an old file...

Basically, cwd only prints out where csh thinks it is, instead of the absolute path that pwd will figure out.

To quote Scott Williamson in that thread:

Yes, the difference is that $cwd will give you the path that the shell took to get to that directory because it doesn't know any better. pwd will give the real physical directory because it starts at the current directory and works back up the hierarchy. So symbolic links and mounting or re-mounting directories will confuse $cwd.

share|improve this answer
1  
The Mac OS version of pwd has a -L switch that displays the current working directory without resolving symbolic links. –  zneak Aug 2 '10 at 19:11

At least under Mac OS, there is a program called pwd in /bin, and it works with tcsh no problem. It's probably there under Linux too.

I suggest you unalias pwd and check with which pwd if you have a replacement.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.