Xref: utzoo comp.sys.ncr:291 comp.unix.questions:22065 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.sys.ncr,comp.unix.questions Subject: Re: Odd vi behaviour inside a shell script. Keywords: vi, sh, stderr, shell scripts Message-ID: <1990May9.060025.23037@athena.mit.edu> Date: 9 May 90 06:00:25 GMT References: <1284@telsys.aut.UUCP> <438@ncrstp.StPaul.NCR.COM> <20829@boulder.Colorado.EDU> Sender: news@athena.mit.edu (News system) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 35 In article <20829@boulder.Colorado.EDU>, meadb@boulder.Colorado.EDU (MEAD BENNETT ROSS) writes: |> 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. It is erroneous to assume that an ioctl works by echoing characters to the screen. In fact, I very much doubt that the ioctl to put the terminal into raw mode echoes anything to the screen. Therefore, what you would have to do is to write a C program to do the ioctl(s) vi does when it starts up, not a C program to echo characters to stdout. However, it is likely that vi doesn't only do ioctl() calls when it starts up -- it also probably does them while it's working. The ioctl()'s it does while it's working will probably fail, and it will lose. Hence I think the suggestion to use ex, rather than vi, was probably a better one. Note that Dan did not suggest the use of ed. He suggested the use of ex, which is very different from ed. Ed is a line-based editor, while ex is display-based (like vi). In fact, ex and vi run the same code, which is why the output of vi and ex are similar. Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710