-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon_f
More file actions
38 lines (34 loc) · 710 Bytes
/
common_f
File metadata and controls
38 lines (34 loc) · 710 Bytes
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
#!/bin/bash (only for syntax highlight)
# common functions
check_argument_present() {
if [ -z "$1" ]; then
echo "Argument missing. Leaving."
exit 1
fi
}
check_config_arg() {
# check for config file
if [ "${1##*.}" != "conf" ]; then
echo "A .conf file is expected. Leaving."
exit 1
fi
if [ ! -f "$1" ]; then
echo "Config file not found. Leaving."
exit 1
fi
return
}
check_config_opts() {
# check config options
if [ ! -f "$BACKUP_LIST" ]; then
echo "Backup list not found, leaving."
exit 1
fi
return
}
create_dir() {
# create dir $1
if [ ! -d "$1" ]; then
mkdir -p "$1"
fi
}