Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
All functions are equal...or ?
- X-seq: zsh-users 11197
- From: Meino Christian Cramer <Meino.Cramer@xxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: All functions are equal...or ?
- Date: Thu, 15 Feb 2007 04:38:54 +0100 (CET)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi,
I wrote a function, which is included in a file ("~/.zsh.functions"),
which itsself is sourced at the very bottom of my .zshrc.
This functions is defined as follows:
lww () {
setopt
if [ ! -z $1 ]
then
echo
case `whence -w $1 | cut -d' ' -f 2` in
(alias) whence -v $1 ;;
(builtin) echo "$1 is a builtin" ;;
(command) echo "$1 is a command:"
ls -l `whence $1` ;;
(function) echo "$1 is a function:"
whence -f $1 ;;
(hashed) echo "$1 is hashed!"
return ;;
(reserved) echo "$1 is a reserved word!"
return ;;
(none) echo "$1 is not found!" ;;
(default) echo "### ERROR" ;;
esac
cmdarray=("${(f)$(whence -pa $1)}")
echo ${#cmdarray} ## 1
echo ${(F)cmdarray}
typeset -U cmdarray
echo ${#cmdarray} ## 2
echo ${(F)cmdarray}
cmdarray=(${(o)cmdarray})
echo ${#cmdarray} ## 3
echo ${(F)cmdarray}
if [[ ${#cmdarray} -ne 0 ]]
then
echo ${(F)cmdarray}
fi
fi
}
The echos are for debugging purposes only.
When I do a "lww ls" from the commandline only the echoes at "##1"
(added later) are printing
3
/bin//ls
/bin/ls
/usr/bin/ls
The following echoes are printing:
0
But!
When doeing a
set - ls
and then cut'n'paste the body of the function lww to the commandline,
all three "echo"-groups are reporting:
3
/bin//ls
/bin/ls
/usr/bin/ls
and then function works.
"setopt" in the head of the funtion and setopt from the commandline
are reporting the same options set.
Where is the bug I do not recognize/realize ? Am I blind ? ;)
Thank you very much for any help in advance!
Slightly confused,
mcc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author