-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample2.sh
executable file
·87 lines (74 loc) · 2.19 KB
/
example2.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
mkdir example2
touch ./example2/client1.txt
touch ./example2/client2.txt
# Start a new Tmux session named 'multi_terminal'
tmux new-session -d -s example2
# Split the window into multiple panes
tmux split-window -h
tmux split-window -h
# Send commands to the panes (adjust commands as needed)
tmux send-keys -t 0 'nc localhost 8888 1>./example2/client1.txt' C-m
tmux send-keys -t 1 'nc localhost 8888 1>./example2/client2.txt' C-m
tmux send-keys -t 0 'register ta1 420420' C-m
sleep 0.05
tmux send-keys -t 1 'register ta2 ta2' C-m
sleep 0.05
tmux send-keys -t 0 'login ta1 420420' C-m
sleep 0.05
tmux send-keys -t 0 'enter-chat-room' C-m
sleep 0.05
tmux send-keys -t 0 'enter-chat-room 1010' C-m
sleep 0.05
tmux send-keys -t 0 'enter-chat-room 20' C-m
sleep 0.05
tmux send-keys -t 0 '/exit-chat-room' C-m
sleep 0.05
tmux send-keys -t 0 'enter-chat-room 30' C-m
sleep 0.05
tmux send-keys -t 0 'hello, i am ta1' C-m
sleep 0.05
tmux send-keys -t 0 'i am waiting for everyone.' C-m
sleep 0.05
tmux send-keys -t 1 'login ta2 ta2' C-m
sleep 0.05
tmux send-keys -t 1 'list-chat-room' C-m
sleep 0.05
tmux send-keys -t 1 'close-chat-room' C-m
sleep 0.05
tmux send-keys -t 1 'close-chat-room 30' C-m
sleep 0.05
tmux send-keys -t 1 'enter-chat-room 30' C-m
sleep 0.05
tmux send-keys -t 1 'merry christmas!' C-m
sleep 0.05
tmux send-keys -t 0 'exit' C-m
sleep 0.05
tmux send-keys -t 1 '/close-chat-room 30' C-m
sleep 0.05
tmux send-keys -t 0 '/exit-chat-room' C-m
sleep 0.05
tmux send-keys -t 0 'list-chat-room' C-m
sleep 0.05
tmux send-keys -t 0 'close-chat-room 35' C-m
sleep 0.05
tmux send-keys -t 0 'close-chat-room 20' C-m
sleep 0.05
tmux send-keys -t 0 'list-chat-room' C-m
sleep 0.05
tmux send-keys -t 0 'close-chat-room 30' C-m
sleep 0.05
tmux send-keys -t 0 'list-chat-room' C-m
sleep 0.05
tmux send-keys -t 0 'exit' C-m
sleep 0.05
tmux send-keys -t 1 'close-chat-room 30' C-m
sleep 0.05
tmux send-keys -t 1 'hello' C-m
sleep 0.05
tmux send-keys -t 1 'exit' C-m
sleep 0.05
tmux send-keys -t 2 'diff ./example2/client1_ans.txt ./example2/client1.txt' C-m
tmux send-keys -t 2 'diff ./example2/client2_ans.txt ./example2/client2.txt' C-m
# Attach to the Tmux session to view the created panes
tmux attach-session -t example2