niedziela, 9 czerwca 2013

Escape chars


  • When you have to send a control sequence/character to programs like Ctrl-C or Esc and you don't have an editor that allows you to put them directly in your script you can send the octal equivalent. Tcl provides a way of encoding using octal or hex. For example to send the Esc character you would use send "\033". To find the octal number for any key use the program od. Start it with "od -c". Press the function key you want to know about. Then hit return. Lastly, press Ctrl-D. The string between the 0000000 and \n is what you want. You could also try it this way: Type "echo " on the command line. Then Ctrl-V, then the key you want to see (lets say Ctrl-C). Then it will print ^C. After that put "|od -cb". This will print out the octal code between 0000000 and \n like before. Ctrl-C is octal 003.

Brak komentarzy:

Prześlij komentarz

Ginekolog dr n. med. Piotr Siwek

Gabinet ginekologiczny specjalista ginekolog - położnik dr n. med. Piotr Siwek