2

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).

1
  • Meta: I believe you should have added the word "pwd" to the question's title. Oct 3, 2013 at 9:53

2 Answers 2

5

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.

1
  • 1
    The Mac OS version of pwd has a -L switch that displays the current working directory without resolving symbolic links.
    – zneak
    Aug 2, 2010 at 19:11
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .