Shell Note 2 Tput

Source: Internet
Author: User

Shell Array

Command_list= (

[add]= ' Add '

[del]= ' Delete '

[edit]= ' Modify '

[query]= ' query '

)


Get index: ${!command_list[*]}, according to the index submission value, perform the corresponding operation.

Get length: ${#command_list [*]}, traversing by length, removing all elements.

Print List: ${command_list[@]}


--------------------------------------------

Password input is not displayed:

echo "Please enter your password:"

Stty-echo

Read password

Stty Echo

echo "Password: $password"


--------------------------------------------

Tput

Tput SC: Saves the current cursor position. The SC option is "Save cursor position".

Tput RC: Return to the original location that was saved using Tput SC. The RC option is "restore cursor position".


SETB option (to set the background color)

SETF option (used to set the foreground color, that is, the text color)

0: Black

1: Blue

2: Green

3: Cyan

4: Red

5: Magenta

6: Yellow

7: White


Tput Bold: Bold

Tput Smul: Add underline

Tput Rmul: Stop adding underscores

Tput clear: Clear the screen

Tput Civis: Hide cursor

Tput cnorm: Display cursor


--------------------------------------------

:() {:|:&};:


--------------------------------------------

Read-t 10-n 3-p "Please enter three characters in 10 seconds:" Answer

If [$?-eq 0]

Then echo "The answer you entered is: $answer"

Else

echo "Sorry, input timed out!" "

Fi


This article is from a "sense of direction" blog, be sure to keep this source http://itech.blog.51cto.com/192113/1789650

Shell Note 2 tput

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.