28 lines
520 B
Plaintext
28 lines
520 B
Plaintext
function jmod
|
|
{
|
|
typeset dir root sel
|
|
typeset -a dirs names
|
|
typeset -i i=0
|
|
|
|
(( $# != 1 )) && return 64
|
|
root=$(jr && pwd)/modules/apps
|
|
set -A dirs $(find $root -maxdepth 2 -mindepth 2 -type d -iregex ".*/[^/]*$1[^/]*" | sort)
|
|
(( ${#dirs[@]} == 0 )) && return 1
|
|
for dir in ${dirs[@]}
|
|
do
|
|
names[$i]=${dir##*/}
|
|
let i++
|
|
done
|
|
if (( ${#names[@]} > 1 ))
|
|
then
|
|
select sel in ${names[@]}
|
|
do
|
|
print ${sel} && cd ${dirs[(( REPLY - 1 ))]}
|
|
break;
|
|
done
|
|
else
|
|
print ${names[0]} && cd ${dirs[0]}
|
|
fi
|
|
osc pwd
|
|
}
|