-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathctw.sh
executable file
·64 lines (60 loc) · 1007 Bytes
/
ctw.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /bin/sh
# Simple shell script to generate appropriate escape sequences so
# that user can change attributes of the CTW widget on the fly without
# having to remember those sequences.
ESC=""
BEL=""
set_font ()
{
echo -n "${ESC}]50;$1$BEL"
}
set_log_file ()
{
echo -n "${ESC}]46;$1$BEL"
}
set_window_size ()
{
echo -n "${ESC}[8;$1;$2t"
}
get_answer ()
{
echo -n $1
read answer
}
option=""
while [ "$option" = "" ];
do
echo ""
echo " Ctw Options Setup"
echo " ================="
echo ""
echo "Select an option to set:"
echo ""
echo " 1. Change font"
echo " 2. Change log file"
echo " 3. Change window size"
echo ""
echo "Enter option: \c"
read option
case "$option" in
1) get_answer "Font name: "
;;
2) get_answer "Log file name: "
;;
3) get_answer "New size (height width): "
;;
*) option= ; ;;
esac
done
if [ "$answer" = "" ]; then
exit 0
fi
case "$option" in
1) set_font $answer
;;
2) set_log_file $answer
;;
3) set_window_size $answer
;;
esac
exit 0