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 MAA23568 for ; Mon, 30 Sep 1996 12:41:12 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id WAA04885; Sun, 29 Sep 1996 22:37:50 -0400 (EDT) Resent-Date: Sun, 29 Sep 1996 22:37:50 -0400 (EDT) From: Geoff Wing Message-Id: <199609300232.MAA23467@coral.primenet.com.au> Subject: Startup-file patch and some tcsh emulations To: zsh-workers@math.gatech.edu Date: Mon, 30 Sep 1996 12:32:02 +1000 (EST) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"hPyHo1.0.FC1.v9pJo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2177 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Heyla, just a small patch to provide some emulations for csh/tcsh functions: glob, printenv, setenv, unsetenv, and a sample filetest (which could use quite a bit of improvement in checking options). There are a couple of others I was thinking of doing to ease any transition from tcsh. (BTW, anyone ever seen glob or filetest used?) Note: In StartupFiles, all the files have a header line like Generic .zshrc file for zsh 2.7 Umm, which version? Question: Also, the parsing with [[ is a bit strict. I had to use [ in filetest. Is it due to the order of parsing [[ coming before variable expansions or some such? Maybe one of these years I'll have time to learn how zsh works! Patch: *** Functions/filetest.~1~ Mon Sep 30 12:01:16 1996 --- Functions/filetest Mon Sep 30 12:00:21 1996 *************** *** 0 **** --- 1,30 ---- + #! /usr/local/bin/zsh + local OPTIONARG + if [ $# -lt 2 ] + then + echo "filetest: Too few arguments." + elif [[ $1 > "-z" ]] + then + echo "filetest: Malformed file inquiry." + else + OPTIONARG=$1 + shift + if [ "$OPTIONARG" $1 ] + then + echo -n 1 + else + echo -n 0 + fi + shift + repeat $# + do + if [ "$OPTIONARG" $1 ] + then + echo -n " 1" + else + echo -n " 0" + fi + shift + done + echo + fi *** Functions/glob.~1~ Mon Sep 30 12:01:33 1996 --- Functions/glob Mon Sep 30 12:00:21 1996 *************** *** 0 **** --- 1,11 ---- + #! /usr/local/bin/zsh + if [ $# != 0 ] + then + echo -n $1 + shift + repeat $# + do + echo -n "\000$1" + shift + done + fi *** Functions/printenv.~1~ Mon Sep 30 12:01:21 1996 --- Functions/printenv Mon Sep 30 12:00:21 1996 *************** *** 0 **** --- 1,2 ---- + #! /usr/local/bin/zsh + export *** Functions/setenv.~1~ Mon Sep 30 12:01:24 1996 --- Functions/setenv Mon Sep 30 12:00:21 1996 *************** *** 0 **** --- 1,11 ---- + #! /usr/local/bin/zsh + # setenv emulation + if [ $# -eq 0 ] + then + export + elif [ $# -le 2 ] + then + export $1=$2 + else + echo "setenv: Too many arguments." + fi *** 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 *** StartupFiles/zshrc 1996/05/02 22:57:04 2.0 --- StartupFiles/zshrc 1996/09/30 01:59:13 *************** *** 40,46 **** alias lsa='ls -ld .*' # Shell functions ! setenv() { export $1=$2 } # csh compatibility # Where to look for autoloaded function definitions fpath=(~/.zfunc) --- 40,49 ---- alias lsa='ls -ld .*' # Shell functions ! if [[ -n "$DISPLAY" ]] ; then ! print -Pn ']2;%~' # XTerm Title Change to %~ - the current ! chpwd() { print -Pn ']2;%~' } # directory in prompt escape sequences ! fi # Where to look for autoloaded function definitions fpath=(~/.zfunc) *************** *** 50,59 **** # (the executable bit is not necessary, but gives # you an easy way to stop the autoloading of a # particular shell function). ! for dirname in $fpath ! do ! autoload $dirname/*(.x:t) ! done # Global aliases -- These do not have to be # at the beginning of the command line. --- 53,63 ---- # (the executable bit is not necessary, but gives # you an easy way to stop the autoloading of a # particular shell function). ! if [[ -n "$fpath" ]] ; then ! for dirname in $fpath ; do ! autoload $dirname/*(.x:t) ! done ! fi # Global aliases -- These do not have to be # at the beginning of the command line. -- Geoff Wing [mason@primenet.com.au] PrimeNet - Internet Consultancy Web: http://www.primenet.com.au/ Facsimile: +61-3-9819 3788