forked from graste/dotfiles-etc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-files.sh
executable file
·69 lines (61 loc) · 1.45 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
#!/bin/bash
# $(dirname ${BASH_SOURCE[0]})
# DOTFILES_DIR=$(dirname "$0")
if [ -L $0 ] ; then
ME=$(readlink $0)
else
ME=$0
fi
DOTFILES_DIR=$(dirname $ME)
SOURCE_DIR=$(pwd -P $DOTFILES_DIR)
FILES=(
.ackrc
.bash
.bash_aliases
.bash_logout
.bash_profile
.bashrc
.inputrc
.profile
.screenrc
.vimrc
.gitignore
.gitconfig
.vim
bin
)
SPECIAL=(
.ssh/config
)
NUM=${#FILES[@]}
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
mkdir ${HOME}/.bash
mkdir ${HOME}/bin
mkdir -p ${HOME}/.vim/{autoload,bundle,backup,swap,undo}
for (( i = 0 ; i < NUM ; i++ ))
do
if [[ $@ == *all* ]]
then
cp -R ${SOURCE_DIR}/${FILES[$i]} ${HOME}/
else
cp -iR ${SOURCE_DIR}/${FILES[$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