cd "previous directory" ??

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

cd "previous directory" ??

Muhali
In unix shells one has the command 'cd -' which brings one back to the previous directory.

Is there anything like that in octave? And if not, is it easy to implement?

M.
Reply | Threaded
Open this post in threaded view
|

Re: cd "previous directory" ??

andy buckle
On 20 February 2012 23:26, Muhali <[hidden email]> wrote:
> In unix shells one has the command 'cd -' which brings one back to the
> previous directory.
>
> Is there anything like that in octave? And if not, is it easy to implement?
>
> M.
>

?

d=pwd();
cd foo
% stuff
cd(d)


--
/* andy buckle */
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: cd "previous directory" ??

Liam Groener-2
In reply to this post by Muhali
On Feb 20, 2012, at 3:26 PM, Muhali wrote:

n unix shells one has the command 'cd -' which brings one back to the
previous directory.

Is there anything like that in octave? And if not, is it easy to implement?

cd .. 
works for me just like in unix. Maybe it goesn't work in Windows, if that is what you are using? (I'm on a Mac, but I've got to believe it works in linux too.)
Liam

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: cd "previous directory" ??

Joanna Cheng
On Tue, Feb 21, 2012 at 11:56 AM, Liam Groener <[hidden email]> wrote:
On Feb 20, 2012, at 3:26 PM, Muhali wrote:

n unix shells one has the command 'cd -' which brings one back to the
previous directory.

Is there anything like that in octave? And if not, is it easy to implement?

cd .. 
works for me just like in unix. Maybe it goesn't work in Windows, if that is what you are using? (I'm on a Mac, but I've got to believe it works in linux too.)
Liam

Hi Liam,

"cd .." is not the same functionality as "cd -". Observe:

joannac@vervet:~$ pwd
/home/joannac
joannac@vervet:~$ cd test1/test2/
joannac@vervet:~/test1/test2$ cd -
/home/joannac
joannac@vervet:~$ cd -
/home/joannac/test1/test2

It seems to have a limited memory (it only remembers the immediately previous point in the directory tree you were in).

I am not sure if Muhali requires this specific functionality, however.

Thanks,
Joanna

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: cd "previous directory" ??

Muhali
In reply to this post by Liam Groener-2
> cd ..

that brings you only up one level.

Defining my own cd function would be easy, but maybe there is already something (faster).
Reply | Threaded
Open this post in threaded view
|

Re: cd "previous directory" ??

Muhali
In reply to this post by Joanna Cheng
> joannac@vervet:~$ cd test1/test2/
> joannac@vervet:~/test1/test2$ cd -
> /home/joannac

I assume you are in a shell. In octave that doesn't work (but is exactly what I'm looking for).
Reply | Threaded
Open this post in threaded view
|

Re: cd "previous directory" ??

Doug Stewart-4


On Mon, Feb 20, 2012 at 8:12 PM, Muhali <[hidden email]> wrote:
> joannac@vervet:~$ cd test1/test2/
> joannac@vervet:~/test1/test2$ cd -
> /home/joannac

I assume you are in a shell. In octave that doesn't work (but is exactly
what I'm looking for).


--
View this message in context: http://octave.1599824.n4.nabble.com/cd-previous-directory-tp4405444p4405663.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

cd by itself take you to your home dir.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave