Return the base path or file name from a full path

Given the full path:

/usr/local/bin/foo

Return the file name:

jemurray@mbp-2019:~ $ basename /usr/local/bin/foo
foo

Return the directory path:

jemurray@mbp-2019:~ $ dirname /usr/local/bin/foo
/usr/local/bin