zsh-users
 help / color / mirror / code / Atom feed
* Re: vared -h question
       [not found] <14435.46049.340193.377803@pdx.itasoftware.com>
@ 1999-12-24 22:07 ` Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-12-24 22:07 UTC (permalink / raw)
  To: Zsh list

Greg Klanderman wrote:
> 
> Hi,
> 
> I'm trying to use vared to implement a simple read/eval/print loop:
> 
> while cmd="" && vared -p "cmd: " cmd ; do
>   ## send cmd to server on host:port and print result
> done
> 
> I'd like to have history work, and if I use the -h flag I can access
> the shell's history, but vared does not store the history of my
> entered commands into the shell history it seems.  So it's a bit
> useless.  Is there any way to do what I want, ie add a line into 
> the history?

(I've redirected this to zsh-users.)

The answer should be to stick `print -s $cmd' as the first command inside
the loop, as well as adding the -h flag to vared.  Embarassingly (at least
in the latest 3.1.6++), that doesn't work properly because you don't get
the most recent command in the history, though you do get the second most
recent --- i.e. the third time round the while-loop you'll be able to
re-edit what you entered on the first.

This is just the latest in a huge line of off-by-one errors in the history
code.  Anyone want to fix it?

Happy Christmas and a bug-free 1900 to all zsh users.


(yes, it's a joke.  no, I'm not expecting the world to end.)

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-12-24 22:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <14435.46049.340193.377803@pdx.itasoftware.com>
1999-12-24 22:07 ` vared -h question Peter Stephenson

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).