Recently I needed to debug a GNU autoconf configure script which seems
to do funky things with stdin and stdout. I realized that the shell
debuggers really should have the equivalent of gdb's "set inferior
tty" (
http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(gdb)Input/Output)
The below is a little test that I came up with.
#!/usr/local/bin/ksh
exec 7<&0 </dev/null 6>&1 # Line taken from an autoconf "configure" script.
#...
typeset -i _Dbg_fdi
exec {_Dbg_fdi} <>/dev/pts/1
while read "foo >" args <&${_Dbg_fdi}
print -- "$line" >&${_Dbg_fdi}
done
Unfortunately this doesn't work. I get the message:
exec: {_Dbg_fdi}: not found
Also, I'd like to test to see if a string name of a device is a valid
terminal. Here's what I'm currently using:
function _Dbg_is_tty {
(( $# != 1 )) && return 1
[[ -r "$1" && -w "$1" ]] && return 0
return 1
}
One could also throw in a test for character devices. But is there
something better?
Thanks.
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users