
{"id":5337,"date":"2011-07-17T11:01:03","date_gmt":"2011-07-17T11:01:03","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=5337"},"modified":"2011-07-17T11:01:03","modified_gmt":"2011-07-17T11:01:03","slug":"basename-strip-directory-and-suffix-from-filenames","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2011\/07\/17\/basename-strip-directory-and-suffix-from-filenames\/","title":{"rendered":"basename &#8211; strip directory and suffix from filenames"},"content":{"rendered":"<h5><u> A UNIX Command <\/u><\/h5>\n<pre>\n$basename\nbasename: missing operand\nTry `basename --help' for more information.\n$basename \/usr\/bin\/\nbin\n$basename \/usr\/\nusr\n$\n$basename \/usr\/bin\/less\nless\n$basename \/usr\/include\/ma\nmalloc.h  math.h\n$basename \/usr\/include\/math.h\nmath.h\n$basename \/usr\/include\/math.h .\nmath.h\n$basename \/usr\/include\/math.h .h\nmath\n$basename \/usr\/lib\/libgccpp.so.1\nlibgccpp.so.1\n$basename \/usr\/lib\/libgccpp.so.1 .1\nlibgccpp.so\n$\n\n<\/pre>\n<p><\/p>\n<h5><u> UNIX Explanation <\/u> <\/h5>\n<pre>\n`basename' removes any leading directory components from NAME.\nSynopsis:\n\n     basename NAME [SUFFIX]\n\nIf SUFFIX  is specified  and is identical  to the  end of\nNAME, it is  removed from NAME as well.   Note that since\ntrailing  slashes are removed  prior to  suffix matching,\nSUFFIX   will  do   nothing  if   it   contains  slashes.\n`basename' prints the result on standard output.\n\nTogether, `basename' and `dirname' are designed such that\nif `ls  \"$name\"' succeeds, then the  command sequence `cd\n\"$(dirname  \"$name\")\";  ls  \"$(basename \"$name\")\"'  will,\ntoo.   This  works   for  everything  except  file  names\ncontaining a trailing newline.\n\nPOSIX allows the implementation  to define the results if\nNAME  is  empty  or   `\/\/'.   In  the  former  case,  GNU\n`basename' returns the empty string.  In the latter case,\nthe result is `\/\/' on platforms where \/\/ is distinct from\n\/, and `\/' on platforms where there is no difference.\n\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A UNIX Command $basename basename: missing operand Try `basename &#8211;help&#8217; for more information. $basename \/usr\/bin\/ bin $basename \/usr\/ usr $ $basename \/usr\/bin\/less less $basename \/usr\/include\/ma malloc.h math.h $basename \/usr\/include\/math.h math.h $basename \/usr\/include\/math.h . math.h $basename \/usr\/include\/math.h .h math $basename \/usr\/lib\/libgccpp.so.1 libgccpp.so.1 $basename \/usr\/lib\/libgccpp.so.1 .1 libgccpp.so $ UNIX Explanation `basename&#8217; removes any leading directory components from &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2011\/07\/17\/basename-strip-directory-and-suffix-from-filenames\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;basename &#8211; strip directory and suffix from filenames&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":-1,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[455,456,590,832],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5337"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=5337"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5337\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=5337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=5337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=5337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}