While jumping from work to work or working at home, you tend to build your own library of alias/functions for the tools you use the most, therefore optimizing your work and increasing your productivity
.
Most of my development is done in interactive unix shells. Even when proprietary development tools must be used (for instance the IAR Embedded Workbench Environment), I stick with cygwin’s bash and my favourite text editor emacs.
Between my most used set of tools are the gotools which allow me to maintain a list of the most used directories and to navigate them in a easy/quick way.
Here are the gotools alias for the tcsh:
alias go='cd `cat $HOME/.links/\!^ | head -1`/\!:2*'
alias godel='(cd $HOME/.links; /bin/rm \!*)'
alias goadd='pwd >$HOME/.links/\!*'
alias golist='(cd $HOME/.links; grep -H . *|sed "s/:/\t->/g")'
I’ve ripped these from someone’s .tcshrc long time ago while working at Siemens (perhaps Alex I don’t remember).
For bash I rewrote them in the form of functions:
# @usage go identifier
# @brief go to directory specified by identifier
go ()
{
cd `cat $HOME/.links/$1 | head -1`
}
# @usage goadd identifier
# @brief adds current directory to the links directory ($HOME/.links)
# as a text file called identifier
goadd ()
{
pwd >$HOME/.links/$*
}
# @usage golist
# @brief lists all current identifiers->links
golist ()
{
old=`pwd`
cd $HOME/.links
grep -H . * | sed "s/:/\t->/g"
cd $old
}
# @usage godel identifier
# @brief remove identifier text file from links directory
godel ()
{
/bin/rm $HOME/.links/$*
}
Probably are better ways of doing this, so keep me posted
2 Comments
1 mouro wrote:
oh yeah, forgot to mention that this won’t work if your target directory contains white spaces…
2 shant wrote:
não havia necessidade
…
abraço de lx
s.