zsh-users
 help / color / mirror / code / Atom feed
* why won't this function work?
@ 2004-07-08  2:37 gj
  2004-07-08  6:49 ` Bart Schaefer
  2004-07-08  9:48 ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: gj @ 2004-07-08  2:37 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-07-12 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-08  2:37 why won't this function work? gj
2004-07-08  6:49 ` Bart Schaefer
2004-07-08  9:48 ` Peter Stephenson
2004-07-12 21:55   ` gj

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).