|
From: | Mark E. Hamilton |
Subject: | Re: How to determine the working directory? |
Date: | Wed, 30 Nov 2005 16:51:38 -0700 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 |
Todd Denniston wrote:
how about this in bash: PWD=`pwd` CVS_REPOSITORY=`cat CVS/Repository` BPWD=`basename $PWD` BCR=`basename $CVS_REPOSITORY` DPWD=`dirname $PWD` DCR=`dirname $CVS_REPOSITORY` while [ "$BPWD" == "$BCR" ] do BPWD=`basename $DPWD` BCR=`basename $DCR` DPWD=`dirname $DPWD` DCR=`dirname $DCR` done echo "base is ($BPWD)"
Timur,FWIW, this will work as long as the top-level directory name is always different than the repository directory name; ie, '1639' instead of 'repository'. If you every use it in a hierarchy where you didn't use the 'cvs checkout -d new_name ...' option it will return the parent directory name; in your case 'tabi'.
-- ---------------- Mark E. Hamilton Orion International Technologies, Inc. Sandia National Laboratory, NM. 505-844-7666
[Prev in Thread] | Current Thread | [Next in Thread] |