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

Re: Is this correct? Redirecting stdin/stout to implement a gdb-like "set inferior tty" in zshdb

On Tue, Dec 09, 2008 at 06:27:48AM -0500, Rocky Bernstein wrote:
> exec 7<&0 </dev/null 6>&1  # Line taken from an autoconf "configure" script.
> #...
> exec {_Dbg_fdi} <> $1
> while : ; do
>   vared -e -h -p "foo> " line <&${_Dbg_fdi} || break

The thing is read doesn't read from fd 0 (not does it write its
prompt or the echoed and controlling characters to fd 0, 1 or 2)
but from/to a fd that was open to the attached terminal upon
start and some that's some fd over 10 so probably hard to
redirect (if I use strace here, I see it reads and writes to fd

You may want to consider the "clone" feature:

info --index-search=clone zsh

>   builtin print -- "$line" >&${_Dbg_fdi}

print -r -- "$line"

>   line=''
> done
> echo "That's all folks! (${_Dbg_fdi})"
> Does zsh have <> like ksh does? It wasn't rejected, so I assume it does.

<> was Bourne already (though I beleive early versions had
issues with it), so it should be recognised by every Bourne-like


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