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