This is a very cool feature which I use a lot!

I'd approach your example with a little script, 'pathparse' which shows you don't need 'dirname' or 'basename':

$ cat pathparse
#!/usr/bin/env bash

path="$1"

directory="${path%/*}"
filename="${path##*/}"
prefix="${filename%.*}"
suffix="${filename#*.}"

printf '%-9s: %s\n' \
    'Directory' "$directory" \
    'Filename' "$filename" \
    'Prefix' "$prefix" \
    'Suffix' "$suffix"

$ ./pathparse /etc/apt/sources.list
Directory: /etc/apt
Filename : sources.list
Prefix   : sources
Suffix   : list