Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Sep 2002 20:43:49 +0200 (CEST)
From:      Oliver Fromme <olli@secnetix.de>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Shell builtin command changed?
Message-ID:  <200209061843.g86IhnHR066470@lurza.secnetix.de>
In-Reply-To: <20020906183733.A51312@sumuk.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Martin Heinen <martin@sumuk.de> wrote:
 > I used command inside a shell function in the following way:
 > 
 > | cd () {
 > |   command cd $* && PS1="`pwd`# "
 > | }
 > 
 > Is this usage of command no longer supported or is it a bug in sh?

I don't know about that bug ("command" works for me, but
my 4-stable is a few weeks older), but I'd suggest the
following definition of the shell function instead:

cd(){ chdir "$@" && PS1="`pwd`# ";}

chdir is simply a pre-defined alias for cd, so you can use
it inside that shell function safely without causing an
endless recursion.  $@" is better than $* because it deals
with whitespace correctly.

Regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"All that we see or seem is just a dream within a dream" (E. A. Poe)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209061843.g86IhnHR066470>