title: Trigger programmatically autocomplete event for shell in system call and get output
body: <p>Before actual question few words about what I'm doing to grasp the idea.</p>
  <p>I would want to add another cool feature to my <em><a href="https://github.com/qooob/authentic-theme" rel="nofollow noreferrer">Authentic Theme</a></em> for <em>Webmin</em>.</p>
  <p>I have made <em>Command Shell</em> module look/feel just if it was <a href="https://rostovtsev.ru/pub/src/authentic/18.40b/shell_port_demo.webm" rel="nofollow noreferrer">ordinary shell</a>. However, as it's only a port, it has few limitations. One of them is missing shell <em>autocomplete</em>, when you hit <code>Tab</code> key (or other based on the system: <code>Esc+Esc</code> and/or <code>Ctrl+I</code>).</p>
  <p>My point is to make it work natively. I'm going to use an
  <code>XMLHttpRequest</code>
  call to the server and pass the part of entered command to the actual shell. The call will be triggered on the event of the <code>Tab</code> key.</p>
  <p>For example, when you're in <em>Authentic Theme</em> dropdown shell (you could see it on the video screencast above), and when you type, let's say, <code>xa</code> and hit <code>Tab</code>, the event will be triggered and make a request. Then the server receives a string <code>xa</code> and we're ready to begin.</p>
  <h3>My question<s>s are</s> is:</h3>
  <p><s>1. What is the best way to execute such command in <em>Perl</em>? </s><br>
  <s>2. How to properly escape such command to make sure that it won't be exploitable;</s><br>
  3. How to <strong>trigger programmatically</strong> <code>Tab</code> key (to run autocomplete) in the <code>system()</code> call;<br>
  <s>4. How to grep output.</s></p>
  <p>On the respond, using <code>xa</code> as an example, I expect to get <code>xargs</code> on the results.</p>
  <hr />
  <p>I'm aware about possibly of ambiguity of the passed command, for example, when using <code>sys</code>, and when autocomplete wouldn't work on the single <code>Tab</code> key. I think it's better to exclude this from the scope of current question.</p>