cc: [EMAIL PROTECTED] Subject: Re: [ast-users] How to redirect terminal stdin/stout to implement a gdb-like "set inferior tty" in kshdb? --------
> 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) I tried this url and I got the message Sorry! - Couldn't find target: "Input/Output)" in file "gdb". > > 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 That is because you put a space between {_Dbg_fdi} and <>. Just as a digit must preceded the redirection operator without a space, the same is true for {...}. > > 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 > } Shouldn't [[ -t 1 ]] work? > > One could also throw in a test for character devices. But is there > something better? > > Thanks. David Korn [EMAIL PROTECTED] _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
