clearing the terminal screen

Maarten Litmaath maart at cs.vu.nl
Fri Dec 16 07:39:43 AEST 1988


lynch at batcomputer.tn.cornell.edu (Tim Lynch) writes:


\I'm having a problem setting an environmental variable to speed up
\screen clearing. If I'm working from a hp terminal the following works:

\  % setenv CLEAR `clear`
\  % echo $CLEAR            # (and the screen is cleared)

\But, if I'm working from a vt100, issuing echo $CLEAR does nothing.
\Furthermore, echo $CLEAR | wc shows that CLEAR is of length zero.
\The terminfo for the vt100 appears ok because I can issue:

\  % clear

The escape code clearing a VT100 screen, contains some magic characters:

	^[[;H^[[2J	(^[ = escape)

The magic characters are `[', `;' and another `['. The `[' character is used
to match filenames, like:

	% echo *.[ch]	# echo all C source + include files

The escape code above doesn't contain a corresponding ']', so csh should have
said:
	Missing ].

(Of course if csh's syntax/parser were right, it wouldn't have parsed the
output of the backquote command at all.)
It's a bug indeed; there's no standard output, because the backquote command
ultimately fails, and csh simply forgets to issue an error message (on stderr).
Solution:

	% setenv	CLEAR	"`clear`"
	% echo "$CLEAR"		# you'll want to put this in an alias
-- 
fcntl(fd, F_SETFL, FNDELAY):          |Maarten Litmaath @ VU Amsterdam:
      let's go weepin' in the corner! |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list