poco/build/script/projname

20 lines
402 B
Plaintext
Raw Normal View History

2006-10-23 17:40:50 +02:00
#! /bin/sh
#
2007-06-13 17:32:13 +02:00
# $Id: //poco/Main/build/script/projname#8 $
2006-10-23 17:40:50 +02:00
#
# projname
#
2007-06-13 17:32:13 +02:00
# Usage: projname PROJECT_BASE
#
2006-10-23 17:40:50 +02:00
# Extract the project name from the current path
2007-06-13 17:32:13 +02:00
# NOTE: the cd $PROJECT_BASE is necessary to resolve symbolic links,
2006-10-23 17:40:50 +02:00
# ditto is the kinda strange sh -c pwd
#
2007-06-13 17:32:13 +02:00
PROJECT_BASE=$1
2006-10-23 17:40:50 +02:00
cdir=`sh -c pwd`
2007-06-13 17:32:13 +02:00
cd $PROJECT_BASE
projbase=`sh -c pwd`
2006-10-23 17:40:50 +02:00
cd "$cdir"
2007-06-13 17:32:13 +02:00
sh -c pwd | sed "s:^$projbase::" | sed "s:^/::"