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