cdbm by itself its relatively
useless. No program executed by the shell is able to change the shell's current directory,
cdbm is no exception, because it's executed by the shell in a subprocess.
However, in combination with shell aliases and functions (ksh and bash), it unleashes its real power:
function c () { cd `cdbm`; ls; }
If the shell's initialisation file (.bashrc, .ksh) contains the line above, the newly
created 'command' c will first display a list of directories, let the user
choose one and then switch to it:
[/tmp] $ c
[1] /apps/NES/https-mike
[2] /home/mschilli/projects/cdbm
[3] /usr/lib/perl5/site_perl
[1-3]>2
/home/mschilli/projects/cdbm
Makefile.PL eg t blib MANIFEST
[/home/mschilli/projects/cdbm] $
All that cdbm does is print out the chosen path name, which is then caught by
the shell function c, which runs cd on it and effectively carries the user
over to the chosen directory, in which it runs a ls command for better
orientation.
cdbm stores the path names in the file .cdbmrc in the user's home directory.
For convenient access, it offers command line options to add, remove and
edit the path collection in .cdbmrc:
cdbm +/foo/bar/path # Add a path to the collection
cdbm -/foo/bar/path # Remove a path from the list
cdbm + # Add the current path to the list
cdbm - # Remove the current path to the list
cdbm -e # Invoke an editor to edit C<.cdbmrc>
cdbm -h # Print help page
Copyright 2002 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.