Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

why won't this function work?



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