autogenerating /etc/issue

Bryan C. Lee leebc11 at acm.org
Tue Jul 3 10:34:39 PDT 2001


> I want to generate my issue file at start-up so it
> reflects the current kernel version, but I also would
> like to include that escape code that resets the
> kernel.
> 
> How do I generate a esc character in a file?
> 
> Sanjuro

If you actually want to generate THE escape character (ascii 27) in a file,
the easiest way I've found is to do:
	cat - > esccharfile

Then hit ESC, and ctrl-d.  You may need to hit ctrl-d twice, but be careful or
you can kill your shell.  This command cats from stdin and redirects output
to a file.  It will put the ESC character in the file, and the ctrl-d
signals EOF, end of file.

In vi you can just type what you want for your /etc/issue, and do a 
	:r esccharfile
to read the escape character from the saved file into your editor buffer.
You'll have to use vi's commands to get it in the right place, and yank/put
is much easier to move it around once the character is in the buffer.  I've
found that vi handles this well, but other editors may not particularly
like it.  

This technique has proven useful to me in setting up raw output to send to
printers. You can also read in other control characters this way, like back
space and control-G (bell).
-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the lfs-dev mailing list