I am using and a do while loop in bash script and executing a python file with some arguments inside the loop, evetime I loop the arguments are updated and the python file is executed again.
The problem is the changes to the arguments are updated in python file.
Please have a look at my code and correct me... Thanks in advance.
mouse.sh
#!/bin/bash
DEVICE="192.168.0.100:5555"
while [ 0 ]
do
adb -s $DEVICE pull /sdcard/motion.log 2>/dev/null
adb -s $DEVICE shell "rm /sdcard/motion.log 2>/dev/null" 2>/dev/null
cat motion.log 2>/dev/null| while read line
do
x=`echo ${line}| cut -d ' ' -f 1`
y=`echo ${line}| cut -d ' ' -f 2`
ipython clicker.py ${x} ${y}
done
rm motion.log 2>/dev/null
done
clicker.py
import sys
while True:
try:
print (sys.argv[1], sys.argv[2])
except:
print ("some error")
motion.log
27 -1 -121
26 -1 -122
25 0 -122
24 0 -123
23 0 -124
22 0 -125
22 0 -126
21 0 -127
20 1 -128
19 1 -129
18 1 -130
17 2 -131
16 2 -132
15 2 -132
14 3 -134
13 3 -135
12 4 -136
11 4 -138
10 5 -139
9 5 -140
9 6 -141
8 6 -142
7 7 -144
7 8 -146
8 9 -148
9 9 -148
11 10 -150
13 10 -151
15 10 -151
16 11 -152
17 11 -152
19 11 -152
20 12 -151
21 12 -151
22 12 -150
23 13 -149
23 14 -148
23 15 -147
23 15 -146
24 16 -146
24 16 -145
24 17 -144
24 18 -144
24 18 -143
24 19 -142
24 20 -141
24 20 -140
24 21 -139
24 22 -139
24 22 -138
24 23 -137
24 23 -136
24 24 -136
24 24 -135
24 25 -134
23 26 -134
23 26 -133
23 26 -132
23 27 -131
23 28 -131
22 28 -130
22 28 -129
22 29 -128
22 29 -127
21 29 -127
21 30 -126
21 30 -125
20 30 -124
20 31 -123
19 31 -122
19 31 -121
19 32 -120
18 32 -120
18 32 -119
18 32 -118
17 33 -117
16 33 -116
16 33 -115
15 33 -114
15 34 -114
14 34 -113
14 34 -112
13 34 -111
13 34 -110
12 34 -110
12 34 -109
11 35 -108
10 35 -107
10 35 -106
9 35 -105
9 35 -104
8 35 -104
8 35 -103
7 35 -102
7 35 -101
6 35 -100
6 35 -99
5 35 -98
5 35 -97
4 35 -96
3 35 -95
3 35 -94
2 35 -93
1 35 -92
1 35 -91
0 35 -90
0 35 -89
-1 35 -88
-1 35 -87
-2 35 -85
-3 35 -84
-3 35 -83
-4 35 -82
-5 34 -81
-6 34 -80
-6 34 -79
-7 34 -78
-8 34 -77
-8 33 -76
-9 33 -75
-10 33 -74
-10 32 -73
-11 32 -72
-11 32 -71
-12 31 -70
-12 31 -69
-13 31 -68
-13 30 -67
-14 30 -67
-14 30 -66
-15 29 -65
-15 28 -64
-16 28 -63
-16 27 -62
-16 27 -61
-17 26 -60
-17 26 -59
-18 25 -59
-18 25 -58
-18 24 -57
-19 24 -56
-19 23 -56
-19 23 -55
-19 22 -54
-20 22 -54
-20 22 -53
-20 21 -53
-20 21 -52
-20 20 -52
-20 19 -51
-20 18 -51
-20 18 -50
-20 17 -50
-20 16 -50
-20 16 -49
-20 15 -49
-20 14 -49
-20 14 -48
-20 13 -48
-20 12 -48
-20 11 -47
-20 10 -47
-20 9 -47
-20 8 -47
-20 8 -46
-20 7 -46
-20 6 -46
-19 6 -46
-19 5 -46
-19 4 -46
-19 3 -46
-18 3 -46
-18 2 -46
-18 1 -46
-18 0 -46
-17 0 -46
-16 -2 -46
-16 -4 -46
-15 -4 -46
-14 -6 -46
-14 -8 -47
-13 -8 -47
-12 -10 -47
-12 -11 -48
-11 -12 -48
-11 -14 -49
-10 -15 -50
-10 -16 -51
-10 -17 -52
-9 -18 -53
-9 -19 -54
-9 -20 -55
-9 -20 -56
-9 -22 -58
-10 -23 -60
-10 -23 -62
-10 -24 -63
-11 -24 -63
-11 -24 -64
-11 -24 -66
-12 -24 -68
-13 -24 -70
-13 -23 -71
-13 -23 -72
-14 -23 -74
-14 -22 -75
-15 -22 -76
-15 -22 -78
-15 -21 -79
-16 -21 -80
-16 -20 -81
-16 -20 -82
-17 -20 -82
-17 -19 -83
-17 -19 -84
-17 -18 -85
-18 -18 -86
-18 -17 -87
-18 -17 -88
-18 -16 -88
-19 -16 -89
-19 -15 -89
-19 -15 -90
-19 -14 -91
-18 -14 -90
Output:
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
25 0
if the initial value is 25 0 it always outputs 25 0, if the initial value is 100 50 it always outputs 100 50. It is always showing bash script initial value its is not updating.
ipythoninstead of justpython?