[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

press the escape key from a text file in vim

Hi,

I would like to create a text file, such that when I "cat" the file from xterm, it is as if I am pressing the <escape> button on my keyboard.  Is there a known way to do this?
0
bryanlloydharris
Asked:
bryanlloydharris
  • 2
2 Solutions
 
TintinCommented:
echo -e "\033" >file
cat file

or simply

echo -e  "\033"

0
 
bpmurrayCommented:
Why not use vim to add the character? You need to use CTRL-V CTRL-[ to add the escape character. Of course, if you're using the windows version, you may have CTRL-V remapped to paste, in which case the default replacement is CTRL-Q, i.e. type CTRL-Q CTRL-[ to add escape to the file.
0
 
TintinCommented:
Good point bpmurray.  I was looking at the question rather than the subject.

Just proves again that it is always better to describe the problem you are trying to solve rather than asking how to solve the way you think it should be done.
0
 
bryanlloydharrisAuthor Commented:
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now