Strip the directory part of a path

Syntax

BASENAME …string-expr…

Typing

STRING -> STRING

Description

Similar to the UNIX tool basename, this removes from the passed operand everything before the last slash ('/'), to keep only the filename portion of a path.

Does nothing if the operand contains no slash.

Examples

expression evaluates to
BASENAME "/foo/bar/baz" "baz"
BASENAME "foo" "foo"