shell脚本中的“请按任意键继续”
原贴:https://www.cnblogs.com/bazingafraser/p/9116393.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/bash get_char() { SAVEDSTTY=`stty -g` stty - echo stty cbreak dd if = /dev/tty bs=1 count=1 2> /dev/null stty -raw stty echo stty $SAVEDSTTY } echo "Press any key to continue!" char=`get_char` echo "" echo "Hello!" echo "http://cto.luxiaok.com" echo "" |