jovanbulck / jsh

A basic UNIX shell implementation in C
GNU General Public License v3.0
30 stars 10 forks source link

a stack of the n most recent directories #33

Open jovanbulck opened 9 years ago

jovanbulck commented 9 years ago

IDEA: push the cwd on a stack on each call to cd and write a simple built_in to e.g. pop the top cwd and cd into it; have a user_defined number of directories to remember (eg via an environment variable?)

--> would be really usefull and probably also easy to implement...

(I think something familiar is done in bash and zsh.)

GijsTimmers commented 9 years ago

I don't think I get it. You mean that you want to have a list of recent directories to cycle through?

GijsTimmers commented 9 years ago

See issue #34:

Quote:

Normally, cd - gets you in the previous directory.

Expected behaviour:

$ pwd
  /etc/apt
$ cd /mnt/Data
$ pwd
  /mnt/Data
$ cd -
$ pwd
  /etc/apt

Actual behaviour:

$ pwd
  /etc/apt
$ cd /mnt/Data
$ pwd
  /mnt/Data
$ cd -
  [DEBUG: You entered: 'cd -']
  [DEBUG: readcmd: cmd 'cd -' expanded to 'cd -']
  [DEBUG: alias: input resolved to: 'cd -']
  jsh: cd: No such file or directory
  [DEBUG: built-in: executed 'cd']
  [DEBUG: freeing comd struct for 'cd']
  [DEBUG: parseexpr: expr evaluated with return value 1]
  [DEBUG: readcmd: freeing memory for: 'cd']
$ pwd
  /mnt/Data
jovanbulck commented 9 years ago

See issue #51 for further discussion