-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (33 loc) · 829 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·43 lines (33 loc) · 829 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
#!/bin/bash
BACKUP_FOLDER="${HOME}/oldConfigs"
SUFFIX=".erc"
echo "Backing up your current conf files in ${BACKUP_FOLDER} in case you change your mind"
function safeMove() {
local answer
if [ "$1" = "README.md" ]; then
return
fi
if [ "$1" = "install.sh" ]; then
return
fi
local base_file=$(basename -s ${SUFFIX} $1)
read -p "Would you like to install .${base_file} (y/n)? " -n 1 answer
echo
if [ "${answer}" = "y" ];
then
mv ${HOME}/".${base_file}" ${BACKUP_FOLDER}/${base_file}
cp $1 ${HOME}/".${base_file}"
else
echo "Skipping"
return
fi
}
if [ ! -d "${BACKUP_FOLDER}" ]; then
mkdir ${BACKUP_FOLDER}
fi
declare -a ALL_FILES=()
ALL_FILES=$(ls *.erc)
for name in ${ALL_FILES[@]}; do
safeMove "${name}"
done
exit 0