Search notes:

Shell command: basename

basename prints the trailing part of a filesystem path. Optionally, it can remove a suffix as well.

Print last part of path

basename  relative/path/to/a/file      # file
basename  relative/path/to/a/file.txt  # file.txt
basename  relative/path/to/a/          # a
basename /absolute/path/to/a/file      # file
basename /absolute/path/to/a/file.txt  # file.txt
basename /absolute/path/to/a/          # a
Github repository shell-commands, path: /basename/remove-directory

Remove last part of path and optionally remove suffix

basename  relative/path/to/a/file      .txt  # file
basename  relative/path/to/a/file.txt  .txt  # file
basename  relative/path/to/a/          .txt  # a
basename /absolute/path/to/a/file      .txt  # file
basename /absolute/path/to/a/file.txt  .txt  # file
basename /absolute/path/to/a/          .txt  # a
Github repository shell-commands, path: /basename/remove-directory-and-suffix

See also

Shell commands such as dirname
Perl module File::Basename

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/sh...', 1758200621, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/shell/commands/basename(63): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78