FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 07-08-2008, 06:28 PM
Fabian Groffen
 
Default ecd function

On 08-07-2008 19:59:05 +0200, Robert Buchholz wrote:
> You can avoid the issue with the license directory by appending a / at
> the end. Grobian showed me that a function is useful for this, I just
> do "ecd xorg-server"
>
> $ grep -A 3 ecd ~/.bashrc
> function ecd () {
> cd ~/devel/gentoo/gentoo-x86/*/$@/
> }

errr, just because my name is involved...

% alias ecd
cd $EPREFIX/usr/portage/*-*/!*

I have it as alias, not as function. If you have a function you can
(and should) actually do more magic, like:

ecd() {
[[ -z $1 ]] && return
p=( $(echo /usr/portage/*/$1) )
if [[ ${p[*]} == *"/*/"* ]] ; then
echo "no such package: $1" > /dev/stderr
elif [[ ${#p[@]} > 1 ]] ; then
echo "multiple options: ${p[*]}"
else
# we can't handle spaces in the paths here anyway
cd ${p[*]}
fi
}

And probably this can be done even better with respect to the glob...


--
Fabian Groffen
Gentoo on a different level
--
gentoo-dev@lists.gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 08:51 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org