From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id HAA01244 for ; Tue, 1 Oct 1996 07:42:47 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id RAA20980; Mon, 30 Sep 1996 17:31:36 -0400 (EDT) Resent-Date: Mon, 30 Sep 1996 17:31:36 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960930143414.ZM21164@candle.brasslantern.com> Date: Mon, 30 Sep 1996 14:34:14 -0700 In-Reply-To: Geoff Wing "Startup-file patch and some tcsh emulations" (Sep 30, 12:32pm) References: <199609300232.MAA23467@coral.primenet.com.au> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail Lite (4.0b.529 29may96) To: Geoff Wing , zsh-workers@math.gatech.edu Subject: Re: Startup-file patch and some tcsh emulations MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"FHrj33.0.k75.tm3Ko"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2180 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sep 30, 12:32pm, Geoff Wing wrote: > Subject: Startup-file patch and some tcsh emulations > Heyla, > just a small patch to provide some emulations for csh/tcsh functions: > glob, printenv, setenv, unsetenv, and a sample filetest What's wrong with: alias glob='print -N' ?? > *** Functions/unsetenv.~1~ Mon Sep 30 12:01:27 1996 > --- Functions/unsetenv Mon Sep 30 12:00:21 1996 > *************** > *** 0 **** > --- 1,11 ---- > + #! /usr/local/bin/zsh > + if [ $# -eq 0 ] > + then > + echo "unsetenv: Too few arguments." > + else > + repeat $# > + do > + unset $1 > + shift > + done > + fi I usually use `typeset +x' rather than `unset' for unsetenv because in {t}csh the environment and non-environment settings are independent; you can have `set FOO=bar' and `setenv FOO blat', and if in that case you do `unsetenv FOO; echo $FOO' you will still get "bar". On the argument that `unsetenv FOO' shouldn't do anything surprising if FOO was never exported in the first place, `unset FOO' is bad. I suppose you could do for var do export | grep \^$var\= >& /dev/null && unset $var done but that seems overkill.