diff --git a/jmod b/jmod new file mode 100644 index 0000000..5704fb4 --- /dev/null +++ b/jmod @@ -0,0 +1,26 @@ +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 +}