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

vared in scripts and history



Hi list,

I've got a question. I'd like to add a vared like line editor to some
interactive command. I've noted the "nslookup" user function approach,
but I was thinking of another way to do it, that would be more flexible:

use GNU screens :exec functionality.

Basically, if (within screen) I run:

screen -X exec '.!.' ./zf $TTY; tr a-z A-Z

Where zf is:

#! /usr/bin/env zsh
trap 'printf "\03"; exit' INT
while a=; vared -p "$2" -e a; do
{
  s=$(stty -g)
  stty -echo
  printf "%s\r" "$a"
  stty "$s"
} < $1
done
printf "\04"

I get the terminal builtin line editor replaced with zsh's line editor
for tr.

Which is already great.

Now, I'd like to add some history support. But I couldn't have it to
work. Is there any way?

TIA
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author