[From]
Https://www.zmrbk.com/post-2030.html
40952771
My understanding is that if the problem described in title occurs, it is because of the combined effect of using different shell programs and corresponding stty to set the corresponding relationship.
This is the message from the/bin/sh inside the stty-a command output:
$ stty-Aspeed38400Baud Rows +; Columns209; line =0; Intr= ^c; Quit = ^\; erase = ^?;Kill= ^u; EOF = ^d; EOL = <undef>; Eol2 = <undef>; Swtch = <undef>; start = ^q; stop = ^s; Susp = ^z; Rprnt = ^r; Werase = ^w; Lnext = ^v; Discard = ^o; Min =1; Time=0;-parenb-parodd-cmspar CS8-HUPCL-CSTOPB cread-clocal-crtscts-IGNBRK-BRKINT-IGNPAR-PARMRK-INPCK-ISTRIP-INLCR-IGNCR ICRNL Ixon-ixoff-iuclc-ixany-imaxbel-Iutf8opost-OLCUC-OCRNL Onlcr-onocr-onlret-ofill-Ofdel nl0 cr0 tab0 bs0 vt0 ff0isig icanon iextenEchoEchoe echok-echonl-noflsh-xcase-tostop-echoprt Echoctl Echoke-flusho-extproc
This is the/bin/bash inside the stty-a command output information, you can see different character mapping:
[Email protected]:~$ stty-Aspeed38400Baud Rows +; Columns209; line =0; Intr= ^c; Quit = ^\; erase = ^h;Kill= ^u; EOF = ^d; EOL = <undef>; Eol2 = <undef>; Swtch = <undef>; start = ^q; stop = ^s; Susp = ^z; Rprnt = ^r; Werase = ^w; Lnext = ^v; Discard = ^o; Min =1; Time=0;-parenb-parodd-cmspar CS8-HUPCL-CSTOPB cread-clocal-crtscts-IGNBRK-BRKINT-IGNPAR-PARMRK-INPCK-ISTRIP-INLCR-IGNCR ICRNL Ixon-ixoff-iuclc-ixany-imaxbel-Iutf8opost-OLCUC-OCRNL Onlcr-onocr-onlret-ofill-Ofdel nl0 cr0 tab0 bs0 vt0 ff0isig icanon iextenEchoEchoe echok-echonl-noflsh-xcase-tostop-echoprt Echoctl Echoke-flusho-extproc
Forwarding the above two articles is a workaround. The simple approach is to use/bin/bash instead of/bin/sh, which is normal in Ubuntu.
^[[a^[[a^[[a^[[b^[[b problem solving when using the upper and lower keys to turn out historical naming in the shell under Linux
Today when using Kali Linux, using the up and down keys to turn over the history command, but there is ^[[a^[[a^[[a^[[b^[[B This stuff, and tab to complete the function of the command can not be used. The final discovery is due to the fact that the shell used by the current user is /bin/Sh. Useradd does not specify a user's shell type, so the default is /bin/sh. 1echo $SHELL2: Change the current user login to the default Shell:chsh-s/bin/bash username or use usermod -s/bin/Bash username command the default shell to change to /bin/Bash is normal. The difference between bash and SH: http://hi.baidu.com/aaronike/item/08cfca8ab2ca145d850fabd3 SH is actually a soft connection of the Dbash.
^h solution appears when Linux uses backspace
Used to execute script under Linux do not pay attention to the wrong content to be deleted always appear ^H, I did not know the truth before I can only run the script again, and later found that there is a solution, so record a bit. ^h is not the meaning of the H-key, is backspace. The main thing is that when your terminal backspace has a problem, it needs to be set. There are two workarounds:1.to use the back-down key (BACKSPACE), hold down the CTRL key 2^h stty erase ^? ^? ^? ^^h added to. CSHRC
[To] Linux under the shell to use the upper and lower keys to turn out the history of the name of the ^[[A^[[A^[[A^[[B^[[B problem resolution, Linux using BACKSPACE ^h solution