Odd vi behaviour inside a shell script.

Jim Smithson jsmithso at aut.UUCP
Fri May 4 22:13:46 AEST 1990


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 at aut.UUCP   FAX: +41 31 527 745   Voice : +41 31 529 214
UUCP: ...!uunet!mcsun!chx400!hslrswi!aut!jsmithso



More information about the Comp.unix.questions mailing list