Is there any bookmarking system available in bash
that will allow me substitute aliases
for real directories?
I am familiar with cdargs
and using cdb
, ca
etc for moving between directories.
I am thinking of a tool which allows me to type:
diff ./file openb(x)/file
where openb(x)
will be a directory in the bookmark system that has been aliased to x
(so that cdb x
, cpb file x
etc all work).
Look at the bookmarking system bookmarks.sh. From the README:
The command
bookmark -e
exports a shell variable from every existing and new bookmark. Add this line
to ~/.bashrc
to use this feature permanently. For the bookmark
vm '/home/vmware.shared-folders'
the variable vm
will be exported. An already existing variable will not be overwritten. The variable can be used with shell commands, e.g.
diff ./file $vm/file
To export only one variable use e.g.
bookmark -e vm
To occasionally resolve a bookmark without exporting a variable use bm
:
diff ./file `bm vm`/file
Please note the backticks: bm
is a shell function.
x=/path/2/dir/x ; y=/path/2/dir/y ; diff ./file $x/file ; cd $x ; cp file $x ... etc
? The var assignments would be in your .bash_rc or other .rc file as you deem appropriate. I've used this sort of thing for years, and it seems good enough, and is portable. Good luck - shellter 2012-04-05 20:50