Odd vi behaviour inside a shell script.

MEAD BENNETT ROSS meadb at boulder.Colorado.EDU
Wed May 9 13:37:38 AEST 1990


In article <438 at ncrstp.StPaul.NCR.COM> mercer at ncrstp.StPaul.NCR.COM (Dan Mercer) writes:
>In article <1284 at telsys.aut.UUCP> jsmithso at aut.UUCP (Jim Smithson) writes:
>:...
>:So I enter the command:		foo.sh 2>&1 |tee foo.log
>:But this totally hoses up `vi`. `vi` runs fine if I enter: foo.sh |tee foo.log
>:But stderr is not written to the logfile. Same with: foo.sh | tee foo.log 2>&1
>:`vi` also runs fine if I enter: foo.sh 2>&1
>:  ...
>
>Vi uses stderr on the ioctl call that sets it up for raw data
>handling.  If stderr is redirected,  the terminal will not be in the 
>correct state,  and all the full screen algorithms will be off.  I
>know of no way around this.
> ...
 
Alright, I don't know what characters are echoed to the screen by ioctl,
but it shouldn't be hard to find out.  Write a C program that echos
these characters to stdout.  Not too bad, but it will require a little research,
and a little C knowledge.  Then put this C program in your shell script.  Not
trivial, but there are ways to get around this problem, but it will take
longer than just using ed.  (as suggested by Dan.)  But it looks like it's 
possible to do this.

			-Bennett.

-----
|  |  meadb%tramp at boulder.colorado.edu |  | Just annother wizard in training. | 
 |  |  | meadb!tramp!boulder!ncar....   |  |  |  |  |  |  |  |  |  |  |  |  |  |
  |  |  |  |meadb!tramp!boulder!sunybcs!rutgers...|  |  |  |  |  |  |  |  |  |



More information about the Comp.unix.questions mailing list