Basename or extract of current working directory – Linux command output
By technese - Last updated: Thursday, November 24, 2011 - Save & Share - Leave a Comment
Four examples:
$ basename `pwd`
$ pwd | awk -F/ '{print $NF}'
$ pwd | sed 's#.*/##'
$ echo "${PWD##*/}"
Reference:
http://stackoverflow.com/questions/1744595/extract-the-last-directory-of-a-pwd-output
http://tldp.org/LDP/abs/html/parameter-substitution.html
Posted in General • • Top Of Page