-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile-utils.sh
executable file
·48 lines (41 loc) · 1.08 KB
/
profile-utils.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
#!/bin/sh
get_sender_by_profile() {
#$1 = path to profile
#$2 = profile id
sed "$2!d" "$1" | awk -F "|" '{print $3}'
}
get_mails_by_profile() {
#$1 = path to config
#$2 = profile id
#$3 = folder
mail_path="$(sed "$2!d" "$1" | awk -F "|" '{print $4}')"
mail_path_folder="$mail_path/$3"
[ ! -d "$mail_path_folder" ] && mail_path_folder="$(find "$mail_path" -type d | \
grep -Ev "(/cur$|/new$|/tmp$)" | grep -F "$3" | head -n 1)"
mlist "$mail_path_folder"
}
get_path_by_profile() {
#$1 = path to config
#$2 = profile id
sed "$2!d" "$1" | awk -F "|" '{print $4}'
}
get_name_by_profile() {
#$1 = path to config
#$2 = profile id
sed "$2!d" "$1" | awk -F "|" '{print $2}'
}
get_trash_by_profile() {
#$1 = path to config
#$2 = profile id
sed "$2!d" "$1" | awk -F "|" '{print $5}'
}
get_draft_by_profile() {
#$1 = path to config
#$2 = profile id
sed "$2!d" "$1" | awk -F "|" '{print $6}'
}
get_attachment_by_profile() {
#$1 = path to config
#$2 = profile id
sed "$2!d" "$1" | awk -F "|" '{print $7}'
}