|
From: | Todd Denniston |
Subject: | Re: How to determine the working directory? |
Date: | Wed, 30 Nov 2005 14:41:12 -0500 |
User-agent: | Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) |
Mark E. Hamilton wrote:
Jim Hyslop wrote:address@hidden wrote:Is there a CVS command that I can issue that will give me the top-level directory from within /home/tabi/1639/source? That is, something like:The file CVS/Repository contains the directory within the repository root. Just be sure not to accidentally change it.Note that both Jim's suggestion and my suggestion #3 will give you 'repository' rather than '1639', and it won't include the directory portion (/home/tabi) of the path. I don't know whether that's important to you or not.
Be careful here, the use of modules can trip you up... OK, you got my scratch itching... 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)"
[Prev in Thread] | Current Thread | [Next in Thread] |