Date: Wed, 20 Feb 2002 17:52:54 +0100 From: Florian Nigsch <flo@nigsch.com> To: "F.Xavier Noria" <fxn@isoco.com> Cc: freebsd-questions@freebsd.org Subject: Re: Bourne shell programming problem Message-ID: <20020220175254.B44134@nigsch.com> In-Reply-To: <20020220174439.436915d2.fxn@isoco.com>; from fxn@isoco.com on Wed, Feb 20, 2002 at 05:44:39PM %2B0100 References: <20020220060104.49523.qmail@web9407.mail.yahoo.com> <20020219234405.V48401@blossom.cjclark.org> <20020220163619.GA3600@raggedclown.net> <20020220174439.436915d2.fxn@isoco.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi!
If you want to do it with bash, here's how:
---------------------------------
p=/foo/bar/deep/down/in/the/tree
while true; do
if [ "${p%/*}" != "" ]; then
p=${p%/*}
else
break
fi
done
echo $p
--------------------------------
bye,
flo
--
---
Florian Nigsch <flo@nigsch.com>
http://flo.nigsch.com/
PGP key: http://flo.nigsch.com/fnigsch.asc
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020220175254.B44134>
