-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcheckprops.sh
executable file
·70 lines (54 loc) · 1.33 KB
/
checkprops.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
#!/usr/bin/env bash
# dev-tcp.sh: /dev/tcp redirection to check Internet connection.
# Script by Troy Engel.
# Used with permission.
. ../bash/fds.linux.inc.sh
. ../bash/json.sh
. ../bash/explode.inc.sh
. ../bash/array_shift.inc.sh
TCP_HOST=podxen.stinkyrabbit.com # RoomLocker
# TCP_HOST=192.168.46.4
TCP_PORT=45678 # Port
HOST="test"
EXAMPLE_STRING="podGetRoomLock {\"casinoId\":\"Live\",\"expiry\":0.00002,\"roomIdArray\":[\"$HOST\"]}"
SHOWWRITE=1
LF=$'\x0a'
podPropertySet() {
local __FUNCTION__="${FUNCNAME[@]:0:1}"
local key=$1
local val=$2
local -A AA
AA[${key}]="${val}"
aaray2json_ref AA
open /dev/tcp/$TCP_HOST/$TCP_PORT "r+"
write $FD "${__FUNCTION__} ${JSON}${LF}"
fgets $FD
# cat <&11
close $FD
return
}
podPropertyGet() {
local __FUNCTION__="${FUNCNAME[@]:0:1}"
local -a keys=( "$@" )
local -a AA
AA=("${keys[@]}")
aaray2json_ref AA
open /dev/tcp/$TCP_HOST/$TCP_PORT "r+"
write $FD "${__FUNCTION__} {\"keys\":${JSON}}${LF}"
fgets $FD
close $FD
return
}
indirect_reference() {
echo "The variable ${1} is equal to ${!1}"
}
while IFS= read
do
echo "$REPLY <<\n";
done < <( declare -p )
# exit
STATE_TEST=7
indirect_reference STATE_TEST
podPropertySet checkprops.testkey checkprops.testval
podPropertySet checkprops.test.sls24.env "$( declare -p )"
podPropertyGet checkprops.test.sls24.env