Xref: utzoo comp.sys.ncr:283 comp.unix.questions:21983 Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!cernvax!chx400!hslrswi!aut!jsmithso From: jsmithso@aut.UUCP (Jim Smithson) Newsgroups: comp.sys.ncr,comp.unix.questions Subject: Odd vi behaviour inside a shell script. Keywords: vi, sh, stderr, shell scripts Message-ID: <1284@telsys.aut.UUCP> Date: 4 May 90 12:13:46 GMT Organization: Ascom Autelca AG, CH-3073 Guemligen Switzerland Lines: 25 Here's a small problem I can't really explain. I am running /bin/sh on my NCR Tower 32/650 under Sys V rel 2.01. Consider a shell script called foo.sh which contains the following two lines: vi foofile not_a_command # here to give some error output I want to run this shell script and capture the output (stdout and stderr) to a logfile, I also want to see the output as it happens. 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 Can anybody explain what the problem is? Can anybody suggest something that will work? Thanks in advance! -- James R. Smithson Ascom Autelca AG CH-3073 Guemligen/Switzerland E-mail: jsmithso@aut.UUCP FAX: +41 31 527 745 Voice : +41 31 529 214 UUCP: ...!uunet!mcsun!chx400!hslrswi!aut!jsmithso