Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Startup-file patch and some tcsh emulations
- X-seq: zsh-workers 2177
- From: Geoff Wing <mason@xxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Startup-file patch and some tcsh emulations
- Date: Mon, 30 Sep 1996 12:32:02 +1000 (EST)
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@xxxxxxxxxxxxxxx] PrimeNet - Internet Consultancy
Web: http://www.primenet.com.au/ Facsimile: +61-3-9819 3788
Messages sorted by:
Reverse Date,
Date,
Thread,
Author