Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 1997 17:04:38 +0100 (MET)
From:      Zahemszky Gabor <zgabor@CoDe.hu>
To:        freebsd-questions@freebsd.org (FreeBSD questions)
Cc:        handy@sag.space.lockheed.com
Subject:   Re: Stupid vi question
Message-ID:  <199702101604.RAA00227@CoDe.hu>
In-Reply-To: <Pine.OSF.3.94.970209100651.2932I-100000@sag.space.lockheed.com> from "Brian N. Handy" at "Feb 9, 97 10:08:45 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> Hey,
> 
> So...here's something that's annoyed me for a long time, and now someone
> else has asked me the same question.
> 
> When you're in vi...if you want to wrap a paragraph of text, you might use
> a command like:
> 
> 	!}fmt
> 
> Now, on every machine other than mine, this works.  On my FreeBSD box, I
> get:
> 	stty: stdin isn't a terminal
> 
> (Though the wrap works fine and there are no other problems.)
> 
> What's going on here?  How do I fix this?

Well, this means, that you have such a shell, that has a ``second''
initialisation file.  (Eg: csh has .cshrc, sh/ksh has the file named in the
ENV variable, bash has Idontknowthename, etc.)  In that file, you have an
stty command.  You have to ``ifdef'' the stty command, like this:
sh/ksh/bash:
if "$-" in
	*i*)	# it is an interactive shell
	stty ...
	any command, which hasn't any meaning in non-interactive shells
	;;
	*)	# it is a non-interactive shell
	any command, which has any meaning in non-interactive shells
	;;
esac

csh/tcsh:
if ( $?prompt ) then
	# interactive shell
	stty ...
	any command, which hasn't any meaning in non-interactive shells
else
	# non interactive shell
	any command, which has any meaning in non-interactive shells
endif

That's it.

Gabor




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702101604.RAA00227>