-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.sh
executable file
·35 lines (27 loc) · 705 Bytes
/
update.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
#!/bin/bash
######################################
## CAUTION ##
## Only run this script on simba-nb ##
######################################
# author: simba-fs
# usage: ./update.sh [list file:./list] [from:~/] [to:./]
# 2020/6/30
[[ -z $1 ]] && list=$(pwd)/list || list=$1;
[[ -z $2 ]] && from=$HOME || from=$(dirname $2);
[[ -z $3 ]] && to="$(pwd)/dot-file" || to=$(dirname $3);
echo list is $list;
echo from $from;
echo to $to;
echo;
echo -n '[n/Y] ';
read n;
[[ "x$n" == "xn" || "x$n" == "xN" ]] && exit 1;
rm -rf $to
mkdir $to
for i in $(cat $list);do
echo $i
echo cp -r $from/$i $to/$i;
mkdir -p $(dirname $to/$i);
cp -r $from/$i $to/$i;
done;
echo finish;