{"id":49,"date":"2011-11-24T00:57:51","date_gmt":"2011-11-24T00:57:51","guid":{"rendered":"http:\/\/technese.com\/?p=49"},"modified":"2012-05-20T00:58:05","modified_gmt":"2012-05-20T00:58:05","slug":"basename-or-extract-of-current-working-directory-linux-command-output","status":"publish","type":"post","link":"https:\/\/technese.com\/index.php\/2011\/11\/24\/basename-or-extract-of-current-working-directory-linux-command-output\/","title":{"rendered":"Basename or extract of current working directory \u00e2\u20ac\u201c Linux command output"},"content":{"rendered":"<p>Four examples:<\/p>\n<pre><code>$ basename `pwd` <\/code><\/pre>\n<pre><code>$ pwd | awk -F\/ '{print $NF}' <\/code><\/pre>\n<pre><code>$ pwd | sed 's#.*\/##' <\/code><\/pre>\n<pre><code>$ echo \"${PWD##*\/}\" <\/code><\/pre>\n<p>Reference:<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/1744595\/extract-the-last-directory-of-a-pwd-output\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/1744595\/extract-the-last-directory-of-a-pwd-output<\/a><\/p>\n<p><a href=\"http:\/\/tldp.org\/LDP\/abs\/html\/parameter-substitution.html\" target=\"_blank\">http:\/\/tldp.org\/LDP\/abs\/html\/parameter-substitution.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Four examples: $ basename `pwd` $ pwd | awk -F\/ &#8216;{print $NF}&#8217; $ pwd | sed &#8216;s#.*\/##&#8217; $ echo &#8220;${PWD##*\/}&#8221; Reference: http:\/\/stackoverflow.com\/questions\/1744595\/extract-the-last-directory-of-a-pwd-output http:\/\/tldp.org\/LDP\/abs\/html\/parameter-substitution.html<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":2,"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":51,"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/posts\/49\/revisions\/51"}],"wp:attachment":[{"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/technese.com\/index.php\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}