[comp.unix.questions] ctrl

maart@cs.vu.nl (Maarten Litmaath) (07/11/89)

guy@auspex.auspex.com (Guy Harris) writes:
\...
\>	cr="`ctrl M`"
\
\You forgot to supply the "ctrl" command - it's not a standard part of S5
\(I couldn't find it, anyway). [...]

comp.sources.unix, april this year.

CTRL(1)                   USER COMMANDS                   CTRL(1)



NAME
     ctrl, unesc - translate printable characters to
                    corresponding control characters
     esc, bell, beep - generate ESC and BEL characters

SYNOPSIS
     ctrl string
     unesc symbolic escape sequence
     esc
     bell [ count ]
     beep [ count ]

DESCRIPTION
     The use of ctrl in all its forms is  to  avoid  real  escape
     sequences in ordinary ASCII files, e.g.  .login.

EXAMPLES
     unesc '^[[7mStandout mode on a Sun console.'
          is equivalent to
     echo "`esc`[7mStandout mode on a Sun console."
     ctrl GG G
          is equivalent to
     bell 3

AUTHOR
     Maarten Litmaath @ VU Informatika Amsterdam
-- 
   "... a lap-top Cray-2 with builtin    |Maarten Litmaath @ VU Amsterdam:
cold fusion power supply"  (Colin Dente) |maart@cs.vu.nl, mcvax!botter!maart

clewis@eci386.uucp (Chris Lewis) (07/12/89)

In article <2855@solo8.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
|guy@auspex.auspex.com (Guy Harris) writes:
|\>	cr="`ctrl M`"
|\You forgot to supply the "ctrl" command - it's not a standard part of S5
|[includes man page for ctrl that Maarten's written in comp.sources.unix]

Um, why not S5 "tputs"?
-- 
Chris Lewis, R.H. Lathwell & Associates: Elegant Communications Inc.
UUCP: {uunet!mnetor, utcsri!utzoo}!lsuc!eci386!clewis
Phone: (416)-595-5425

guy@auspex.auspex.com (Guy Harris) (07/15/89)

 >|\>	cr="`ctrl M`"
 >|\You forgot to supply the "ctrl" command - it's not a standard part of S5
 >|[includes man page for ctrl that Maarten's written in comp.sources.unix]
 >
 >Um, why not S5 "tputs"?

Because:

	1) there's no capability that's *defined* to be a carriage return
	   character (it'd be pointless - why not just use \r?), so
	   you'd have to set TERM in the particular "tputs" command and
	   request some capability that is a \r, which seems like a lot
	   of trouble to just get \r - if you insist on doing it with a
	   command,

		cr=`echo '\r\c'`

	   should do it quite well under S5 (it works under SunOS 4.0,
	   with an S5R3.1-based Bourne shell, if you set PATH to "pick
	   up" the S5 "echo");

	2) the mechanism that worked under BSD in his example should
	   work under S5 as well.