[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Unix General question

As I know , by using escape sequence control, we can
creat special effect Assic art, like moving text. But
here in my university sun solaris terminal, I don't how
to edit a file contains control sequence. Using pico, it
doesn't repond when I press ESC key. What should I do?
Thanks.

0
xz02
Asked:
xz02
1 Solution
 
szetoaCommented:
I may have a solution if you know how to use 'vi'.  First you need to 'insert' an ESC character in a file.  Then you just keep copying this character whenever you need to create another control sequence.  At your UNIX prompt, try this:

echo <ESC> > afile

NOTE:  <ESC> is the escape key, the second '>' is the output redirection, and afile is any file name you want.  This command inserts a single character in the 'afile' and then you can use 'vi' to add other characters after the <ESC>.

p.s.  I believe the <ESC> character looks like ^[, but actually it is only one character.  You can also use 'yank' and 'paste' commands in 'vi' to duplicate this character.
0
 
xz02Author Commented:
Thank you,szetoa,your answer is perfect.
How do give you points?
0
 
szetoaCommented:
xz02,

Glad it helps.  But this is my first time to response to any question and I have no idea how to get points.  Keep the points. You may need them for other questions.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gwaltersCommented:
To get points, you have to "answer", not "comment".
0
 
jos010697Commented:
There's no need to copy those escape characters. Vi has the
^v (control-V) prefix. If you want to insert an escape somewhere
in your text, simply press i ^v <escape>, i.e. 'i' for insert,
^v for 'literal character' and <escape> for escape ...

kind regards,

Jos aka jos@and.nl
0
 
szetoaCommented:
xz02,

Give the points to 'jos'.  S/he got a better answer.
0
 
jos010697Commented:
Who cares about those points (points don't buy you anything ;-)
as long as it helps out 'xz02', everything is fine, isn't it?

kind regards,

Jos aka jos@and.nl

ps. BTW, I'm male ;-)

0
 
ahoffmannCommented:
! echo <ESC> > afile
! NOTE: <ESC> is the escape key, the second '>' is the output redirection, and

szetoa, this doing at a "UNIX prompt" (what do you mean by that?)
will do nothing, in most cases, means you get a file just containing a \n (newline). Ups, you also may hear a beep.
If this will work depends on a lot of thing:
  1. the flaviour of UNIX
  2. the shell (sh, csh, bash, zsh, ash, etc. etc.)
  3. $PATH in this shell, and therefore if it is the shell's builtin echo or an external command found via $PATH

As jos said, you may get these chars by using vi's ^v facility.
But take care using vi with files which have non-visibale chars, use the  `set list'  command in vi to see them all (man vi, you know .. ;-).

And for those who care about the points, I marked it as answer so that it might get off the list of questions :-))
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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