title: "ASCII" codes for arrow up, down, left and right
body: <p>I am writing a program that reads input from Javascript and send those readings to bash.</p>
  
  <p>I can successfully run many actions, like "A-Z" letters, TAB, CTRL+C, etc. But I realize that I cannot send properly to bash the ARROW UP.</p>
  
  <p>If I read the ascii code from Javascript, I get the following as explained <a href="https://stackoverflow.com/questions/1402698/binding-arrow-keys-in-js-jquery">Binding arrow keys in JS/jQuery</a></p>
  
  <pre><code>37 - left
  38 - up
  39 - right
  40 - down
  </code></pre>
  
  <p>However, when I send arrow up to the terminal, decimal key code 38, I write an ampersand (as by following a ascii table <a href="http://www.asciitable.com/" rel="nofollow noreferrer">http://www.asciitable.com/</a>)</p>
  
  <p>So, my question is: what code do I have to send from Java to bash to tell bash "arrow key up" ?</p>
  
  <p>PD_ I realize that it might be different depending on the operating system and this code might not be considered an ascii code as this post suggest: <a href="https://stackoverflow.com/questions/2876275/what-are-the-ascii-values-of-up-down-left-right">enter link description here</a></p>
  
  <p><strong>Edit</strong>
  I write from Java to bash by using the following code:</p>
  
  <pre><code>JSch jsch = new JSch();
  [...]
  Channel channel = session.openChannel("shell");
  OutputStream out = channel.getOutputStream();
  out.write(asciiDecimalCode); // send characters
  </code></pre>
  
  <p>Thanks in advance.</p>