Xref: utzoo comp.sys.ncr:290 comp.unix.questions:22062 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!ncar!boulder!meadb From: meadb@boulder.Colorado.EDU (MEAD BENNETT ROSS) Newsgroups: comp.sys.ncr,comp.unix.questions Subject: Re: Odd vi behaviour inside a shell script. Keywords: vi, sh, stderr, shell scripts Message-ID: <20829@boulder.Colorado.EDU> Date: 9 May 90 03:37:38 GMT References: <1284@telsys.aut.UUCP> <438@ncrstp.StPaul.NCR.COM> Sender: news@boulder.Colorado.EDU Reply-To: meadb@tramp.Colorado.EDU (MEAD BENNETT ROSS) Organization: University of Colorado, boulder Lines: 29 In article <438@ncrstp.StPaul.NCR.COM> mercer@ncrstp.StPaul.NCR.COM (Dan Mercer) writes: >In article <1284@telsys.aut.UUCP> jsmithso@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@boulder.colorado.edu | | Just annother wizard in training. | | | | meadb!tramp!boulder!ncar.... | | | | | | | | | | | | | | | | | |meadb!tramp!boulder!sunybcs!rutgers...| | | | | | | | | |