In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to achieve shortcut key effect under Linux Bash". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "how to achieve shortcut key effect under Linux Bash"!
Always wanted to implement through Bash, as in the VI editor, press a key to perform some kind of operation, a chance to find that stty can be achieved.
Please look at the script first:
#! / bin/sh
# We can use this script to automatically detect keystrokes. As for what it is used for, people have different opinions, and wise people have their own wisdom. "Heroes must have the opportunity to show their talents."
# 2009-12-29 13:00:54 update
# wangxiaoyu (AT) live.com From http://wangxiaoyu.blog.51cto.com
_ tty_setting=$ (stty-g)
Stty-icanon
Stty-echo
# We can use c2 arguement to use keyboard shortcut with 2 characters.
_ key_press=$ (head-C1)
Stty $_ tty_setting
# here is the part to judge the input
#
Case $_ key_press in
A) echo-en "We can replace it here with the command string we want to execute 1\ n"
2) echo-en "We can replace it here with the command string we want to execute 2\ n"
3) echo-en "We can replace it here with the command string 3\ n that we want to execute"
4) echo-en "We can replace it here with the command string 4\ n that we want to execute"
5) echo-en "We can replace it here with the command string we want to execute 5\ n"
6) echo-en "We can replace it here with the command string 6\ n that we want to execute"
Exit 1
*) echo-en "here can be replaced with commands related to the help information of the script\ n"
Esac
Note:
Stty is used to display and modify terminal settings, this complex command can be used in scripts to control the behavior of the terminal or the method of displaying output. Combined with special characters and case or other conditions, we can easily search for files like pressing Ctrol + F.
In the script. Stty-g is used to record the parameters of stty, which can be restored in time after the terminal is modified.
Among them, stty-echo is very common and is often used to require users to enter passwords.
Detailed gossip Linux Bash command query historical event operation function
Talking deeply about LINUX Bash Command Line Editing
In-depth discussion of Linux Bash command and file name extension features
At this point, I believe you have a deeper understanding of "how to achieve shortcut key effect under Linux Bash". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.