robust bookmarking system in bash

Go To StackoverFlow.com

0

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).

2012-04-05 19:19
by ATemp
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


0

Look at the bookmarking system bookmarks.sh. From the README:

SHELL VARIABLES

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

RESOLVE A BOOKMARK

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.

2012-04-06 14:35
by Fritz G. Mehner
Ads