From owner-freebsd-questions Wed Feb 20 8:53: 3 2002 Delivered-To: freebsd-questions@freebsd.org Received: from ulixes.esc.ac.at (ulixes.esc.ac.at [193.170.216.34]) by hub.freebsd.org (Postfix) with ESMTP id 48D1037B402 for ; Wed, 20 Feb 2002 08:52:57 -0800 (PST) Received: from ulixes.esc.ac.at (localhost.esc.ac.at [127.0.0.1]) by ulixes.esc.ac.at (8.12.2/8.12.2) with ESMTP id g1KGqsHr029317; Wed, 20 Feb 2002 17:52:54 +0100 (CET) (envelope-from flo@ulixes.esc.ac.at) Received: (from flo@localhost) by ulixes.esc.ac.at (8.12.2/8.12.2/Submit) id g1KGqsbN029316; Wed, 20 Feb 2002 17:52:54 +0100 (CET) (envelope-from flo) Date: Wed, 20 Feb 2002 17:52:54 +0100 From: Florian Nigsch To: "F.Xavier Noria" Cc: freebsd-questions@freebsd.org Subject: Re: Bourne shell programming problem Message-ID: <20020220175254.B44134@nigsch.com> References: <20020220060104.49523.qmail@web9407.mail.yahoo.com> <20020219234405.V48401@blossom.cjclark.org> <20020220163619.GA3600@raggedclown.net> <20020220174439.436915d2.fxn@isoco.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020220174439.436915d2.fxn@isoco.com>; from fxn@isoco.com on Wed, Feb 20, 2002 at 05:44:39PM +0100 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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