Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!apple!bloom-beacon!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.unix.questions Subject: Re: Help on control keys Message-ID: <34984@think.UUCP> Date: 30 Dec 88 21:22:09 GMT References: <893@husc6.harvard.edu> Sender: news@think.UUCP Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 36 In article <893@husc6.harvard.edu> yylu@walsh.UUCP (Ya Yan Lu) writes: > Is it possible to put some >control characters in an ascii file, so that whenever I read that file >by cat or more, it actually runs a program? In general, the answer is "No". Cat and more mostly just send the characters to the terminal (I think "more" will also recognize certain sequences as indicating underlining and inverse video, and translate them to the appropriate sequence for the terminal). Some terminals have mechanisms whereby a "answerback" strings may be programmed using control sequences, and then another control sequence causes it to send the answerback as if the user had typed it. For such terminals, the file could contain the sequence to program an answerback and then request it to be sent. If the answerback is set to be a command line, this mechanism could be used to cause a program to be run after the file is displayed. When cat or more are used, the >control keys in a file usually have some effect, but I am not so clear >what they really are. Are you referring to the file that displays a train going around a christmas tree when you cat it? In that case, the file simply contains the control sequences that cause characters to be displayed and erased at the appropriate places on a VT100-compatible terminal. The control characters in the file aren't causing a special program to run, they're just being sent to the terminal, and you're seeing the results of those control sequences on the terminal's display. Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar