Linux.com

Four ways to extract the current directory name

Posted by: Anonymous [ip: 127.0.0.1] on November 06, 2007 09:31 AM
The awk and sed solutions given are far more complicated than they need to be.
Simpler solutions are:


pwd | awk -F / '{ print $NF }'

pwd | sed 's,.*/,,'

#

Return to Four ways to extract the current directory name