Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/ttcomtester/tests/color-test.bash

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10521 - (show annotations) (download)
Fri Jan 20 16:03:38 2023 UTC (13 months, 2 weeks ago) by zmatsuo
File size: 803 byte(s)
add communication test tool
1 #!/usr/local/bin/bash
2
3 pause() {
4 printf "=>push return<= "
5 read dummy
6 echo
7 }
8
9 test_color() {
10 case $1 in
11 ?) len=25;;
12 ??) len=26;;
13 ???) len=27;;
14 *) return;;
15 esac
16
17 echo -ne "\e]4;$1;?\a"
18 IFS=: read -n $len dummy cstr
19 reply=$(echo $cstr | tr -d '\07')
20 h=$(printf "%1x0" $1)
21 expected="$h$h/$h$h/$h$h"
22
23 if [ $reply = $expected ]; then
24 printf "o "
25 else
26 printf "x "
27 fi
28 printf "%d: %s %s\n" $1 $reply $expected
29 }
30
31 OLD_MODE=$(stty -g)
32 stty -echo
33
34 seq 0 15 | while read c; do
35 printf "\033[48;5;${c}m "
36 done
37 printf "\033[m\n"
38
39 pause
40
41 seq 0 15 | while read c; do
42 printf "\033]4;${c};#%1x%1x%1x\033\\" $c $c $c
43 done
44
45 pause
46
47 for c in $(seq 0 15); do
48 test_color $c
49 done
50
51 pause
52
53 seq 0 15 | while read c; do
54 printf "\033]104;${c}\033\\"
55 done
56
57 stty $OLD_MODE

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26