<tt>basename</tt>: Current Directory



next up previous contents
Next: dirname: Directory Path Up: Tips Using Shell Previous: Tips Using Shell

basename: Current Directory

basename directory
returns the portion of directory after the last ``/", i.e. the current directory name.

For example,

#!/bin/sh
CUR_DIR=`basename \$cwd`
will set CUR_DIR to be the current directory name from the last ``/" to the end (if the current directory is /usr/people/cantin, it would return cantin).



Super-User
Fri Feb 17 15:55:40 EST 1995