How is the command suggestion implemented in the bash shell?
<pre><code>gk@Jarvis:~$ sudi
No command 'sudi' found, did you mean:
Command 'sudo' from package 'sudo-ldap' (universe)
Command 'sudo' from package 'sudo' (main)
sudi: command not found
</code></pre>

<p>I have currently implemented a simple 'Did you mean..?' for plain English words which works as follow:</p>

<ul>
<li>If user enters 'Kack', check the alphabets around every alphabet in the word on a QWERTY keyboard and substitute them one by one. (e.g. here they would be J,L,M,I,O for 'K'; Q,W,S,Z,X for 'a' and so on)</li>
<li>Return the word with the most probability (the user entered word itself too if that is the case) as the most likely word based on training on a corpus of text.</li>
</ul>

<p>How is the code-suggestion implemented in the linux command line?</p>