fi
}
+findbase() {
+ if [ -r aliases ]; then
+ while read alias rest; do
+ if [ "$alias" = "$1" ]; then
+ echo "$rest"
+ return
+ fi
+ done <aliases
+ fi
+ echo "$1"
+}
+
findfile() {
if [ -n "$debug" ]; then echo "finding base='$1', ep='$2', qual='$3'" >&2; fi
- local file tail eq eqt m matches max score
+ local base file tail eq eqt m matches max score
matches=()
- for file in "$1"*; do
- tail="${file#"$1"}"
+ base="$(findbase "$1")"
+ for file in "$base"*; do
+ tail="${file#"$base"}"
eq="${tail%.*}"
m=n
if [ "${eq%% *}" -eq "$2" ] 2>/dev/null; then
curser=
fi
else
- curser="$base"
+ curser="$(findbase "$base")"
fi
if [ -n "$curser" ]; then
file="$(findfile "$dirbase $curser - " "$ep" "$tqual")" || \