'cd' should return the current working directory with no input arguments

John W. Eaton jwe at octave.org
Tue Nov 30 17:31:51 CST 2010


On 30-Nov-2010, Søren Hauberg wrote:

| (Posting this to the list as the bug tracker doesn't work while I
| remember; I'll post it on the tracker once it's back again).
| 
| It seems that Matlab (for some odd reason) returns the current working
| directory when you call 'cd' without any input arguments. I.e.:
| 
|         >> cd
|         
|         /home/disk10/hauberg
|         
| Basically, it seems like we should do something like
| 
|   if (nargin == 0)
|     retval = pwd ();
|   else
|     cd (input_argument);
|   endif

We've discussed this before and I think we came to a different
conclusion:

  http://octave.1599824.n4.nabble.com/cd-td1651737.html#a1651738

I'm still waiting for a patch to implement the relatively simple
change I suggested in that thread.

Matlab also has pwd.  Why not use that instead of cd if you want to
know the current directory?

jwe




More information about the Bug-octave mailing list