-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbacketc.sh
More file actions
executable file
·50 lines (44 loc) · 914 Bytes
/
backetc.sh
File metadata and controls
executable file
·50 lines (44 loc) · 914 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
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
source movein_conf.sh
usage() {
echo "Usage: $0 [-s src [-d dest] [-n] [-v] [-h]"
echo " -s src default = $src"
echo " -d dest default = $dst"
echo " -n dry run"
echo " -v verbose"
echo " -h print this help message"
exit 1
}
src="/etc"
dst="$movein_etc_src"
dryrun=""
verbose=""
while getopts ":s:d:hnv" o; do
case "${o}" in
s)
src=${OPTARG}
;;
d)
dst=${OPTARG}
;;
n)
dryrun="-n"
;;
v)
verbose="-v"
;;
*) # Note: this covers -h as well
usage
;;
esac
done
shift $((OPTIND-1))
cmd="sudo rsync -a $verbose $src/ $dst/ --filter=\"-/ *\.swp\""
if [ ! -z $verbose ]; then
echo "$cmd"
fi
if [ -z $dryrun ]; then
eval "$cmd"
else
echo "DRYRUN: not running rsync command"
fi