Strip directory and suffix from filenames.

Synopsis

basename NAME [SUFFIX]

Description

Print NAME with any leading directory components removed. If SUFFIX is specified and is identical to the end of NAME, it is removed too. Runs in the just-bash WASM shell inside SLICC.

Examples

$ basename /path/to/file.txt

Prints: file.txt

$ basename /path/to/file.txt .txt

Prints: file

See Also

dirname, realpath