-
Notifications
You must be signed in to change notification settings - Fork 4
/
copy-files.sh
executable file
·74 lines (65 loc) · 1.59 KB
/
copy-files.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
SOURCE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )
TO_COPY=(
.ackrc
.bash
.bash_aliases
.bash_logout
.bash_profile
.bashrc
.ctags
.gitconfig
.gitignore_global
.inputrc
.markdownlintrc
.pam_environment
.profile
.screenrc
.tmux.conf
.vim
.vimrc
.wgetrc
bin
)
SPECIAL=(
.ssh/config
)
NUM=${#TO_COPY[@]}
echo "Hello ${USER},"
echo ""
echo "this script will copy (and overwrite) ${NUM} items from ${SOURCE_DIR} to ${HOME}."
echo ""
echo "Hint: use 'all' as a command line argument to copy files in non-interactive mode."
echo ""
read -p "Press enter or abort via CTRL+C..." pleaseimscared
if [[ $@ == *all* ]]
then
rm -rf ${HOME}/.vim/bundle/*
fi
mkdir ${HOME}/.bash
mkdir ${HOME}/bin
mkdir ${HOME}/.npm-global
mkdir -p ${HOME}/.vim/{autoload,bundle,backup,swap,undo}
for (( i = 0 ; i < NUM ; i++ ))
do
if [[ $@ == *all* ]]
then
cp -R ${SOURCE_DIR}/${TO_COPY[$i]} ${HOME}/
else
cp -iR ${SOURCE_DIR}/${TO_COPY[$i]} ${HOME}/
fi
done
NUM=${#SPECIAL[@]}
for (( i = 0 ; i < NUM ; i++ ))
do
echo "File ${SOURCE_DIR}/${SPECIAL[$i]} with content:"
echo "-----------------------------------------------"
cat ${SOURCE_DIR}/${SPECIAL[$i]}
echo "-----------------------------------------------"
echo "If you need this file, you should copy the file (or it's content) via:"
echo "cp -iR ${SOURCE_DIR}/${SPECIAL[$i]} ${HOME}/"
echo ""
#read -p "Press <enter> for next file..."
done
echo "See README.md for programs (linters) you might want to install."
echo ""