-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_lib.sh
More file actions
45 lines (36 loc) · 1.04 KB
/
config_lib.sh
File metadata and controls
45 lines (36 loc) · 1.04 KB
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
#!/bin/bash
source config.sh
[ -z "$USERID" ] && echo "'USERID' Variable ist leer oder nicht deklariert. SET USERID=$(id -u)"
USERID="${USERID:-$(id -u)}"
[ -z "$GROUPID" ] && echo "'GROUPID' Variable ist leer oder nicht deklariert. SET GROUPID=$(id -g)"
GROUPID="${GROUPID:-$(id -g)}"
# Max length of longest Entrie
get_sync_entries_max_length() {
local max_len=0
for entry in "${SYNC_ENTRIES[@]}"; do
if (( ${#entry} > max_len )); then
max_len=${#entry}
fi
done
echo $max_len
}
get_sync_entry_by_index_max_length() {
local index="$1"
for entry in "${SYNC_ENTRIES[@]}"; do
local source_path
source_path=$(echo "$entry" | cut -d';' -f$index)
if (( ${#source_path} > max_len )); then
max_len=${#source_path}
fi
done
echo $max_len
}
get_sync_title_max_length() {
get_sync_entry_by_index_max_length 1
}
get_sync_source_max_length() {
get_sync_entry_by_index_max_length 2
}
get_sync_destination_max_length() {
get_sync_entry_by_index_max_length 3
}