1 |
On 08-07-2008 19:59:05 +0200, Robert Buchholz wrote: |
2 |
> You can avoid the issue with the license directory by appending a / at |
3 |
> the end. Grobian showed me that a function is useful for this, I just |
4 |
> do "ecd xorg-server" |
5 |
> |
6 |
> $ grep -A 3 ecd ~/.bashrc |
7 |
> function ecd () { |
8 |
> cd ~/devel/gentoo/gentoo-x86/*/$@/ |
9 |
> } |
10 |
|
11 |
errr, just because my name is involved... |
12 |
|
13 |
% alias ecd |
14 |
cd $EPREFIX/usr/portage/*-*/!* |
15 |
|
16 |
I have it as alias, not as function. If you have a function you can |
17 |
(and should) actually do more magic, like: |
18 |
|
19 |
ecd() { |
20 |
[[ -z $1 ]] && return |
21 |
p=( $(echo /usr/portage/*/$1) ) |
22 |
if [[ ${p[*]} == *"/*/"* ]] ; then |
23 |
echo "no such package: $1" > /dev/stderr |
24 |
elif [[ ${#p[@]} > 1 ]] ; then |
25 |
echo "multiple options: ${p[*]}" |
26 |
else |
27 |
# we can't handle spaces in the paths here anyway |
28 |
cd ${p[*]} |
29 |
fi |
30 |
} |
31 |
|
32 |
And probably this can be done even better with respect to the glob... |
33 |
|
34 |
|
35 |
-- |
36 |
Fabian Groffen |
37 |
Gentoo on a different level |
38 |
-- |
39 |
gentoo-dev@l.g.o mailing list |