Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
why won't this function work?
- X-seq: zsh-users 7667
- From: gj@xxxxxxxxxxxxx
- To: zsh-users@xxxxxxxxxx
- Subject: why won't this function work?
- Date: Thu, 8 Jul 2004 02:37:41 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi all.
I'm trying to convert a function I wrote in bash to zsh. How can I get this to work?
selhist ()
{
TAB=' ';
(( " $# < 1 " )) && {
echo "Usage: selhist [command]";
return 1
};
oldIFS=$IFS;
IFS='
';
cmd=("" `grep -w $1 $HISTFILE | sort | uniq | pr -tn` "");
IFS=$oldIFS;
printf "%s\n" "${cmd[@]}" | less -F;
echo -n "enter number of desired command [1 - $(( ${#cmd[@]} - 2 ))]: ";
read answer;
eval "${cmd[$answer]#*$TAB}"
}
Thanks,
GJ
Messages sorted by:
Reverse Date,
Date,
Thread,
Author