-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathu
executable file
·93 lines (68 loc) · 1.48 KB
/
u
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
88
89
90
91
92
#!/bin/bash
SETCOLOR_SUCCESS="echo -en \\033[0;32m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
declare TTL="CHAT"
declare pw=$("pwd")
declare project=""
if [[ $pw =~ (.*\/)(.*) ]]; then
project=${BASH_REMATCH[2]}
fi
declare src="$pw/src/$project"
declare bin="$pw/bin"
function check_dirs() {
local -n ari=$1
# creates folders if not exists
for page in "${ari[@]}"
do
IFS=";" read -r -a arr <<< "${page}"
declare fde="${arr[1]}"
declare dirna="$(dirname "${fde}")"
if [ ! -e $dirna ]; then
echo "creating $dirna"
mkdir -p $dirna
fi
done
}
function copira() {
local -n acp=$1
declare some=""
for page in "${acp[@]}"
do
IFS=";" read -r -a arr <<< "${page}"
declare fos="${arr[0]}"
declare fot="${arr[1]}"
declare out=$(cp -u -v "$fos" "$fot")
if [[ ! -z $out ]]; then
declare bn=$(basename "$fos")
if [[ ! -z $some ]]; then
some="${some}"$'\n'
fi
some="${some}${bn}"
fi
done
if [[ ! -z $some ]]; then
printf "%-20s%s\n" "$some"
fi
}
EE=(
"vid;$bin/vid/*"
"prcs;$bin/prcs/*"
"sv_logs;$bin/sv_logs/*"
)
PP=(
# config
"$src/config.json;$bin/config.json"
# bash scripts
"$src/scr/s_s;$bin/scr/s_s"
"$src/scr/k_s;$bin/scr/k_s"
)
echo -en "\033]0;$TTL\a"
clear
check_dirs EE
check_dirs PP
while true;
do
copira PP
sleep 1
done
exit 0