-
Notifications
You must be signed in to change notification settings - Fork 0
/
link.sh
executable file
·34 lines (28 loc) · 819 Bytes
/
link.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
#!/bin/bash
while :
do
# Get all the directories
dotfiles=$(find . -maxdepth 1 -not -name "." -not -name ".git" -type d -printf '%P\n')
# Check if array of directory is empty
if [[ -z "$dotfiles" ]]; then
echo "There are no dotfiles here!"
fi
PS3="Choose which dotfile you want to link: "
#Symlink dotfiles to the specified location
select dotfile in ${dotfiles}
do
echo -e "Where do you want to link the files? (empty for $HOME): \c"
read -e location
if [ -z "$location" ]; then
location="${HOME}"
fi
echo "Symlinking to $location ..."
stow --verbose=2 $dotfile -t $location
retval=$?
if [ $? -eq 0 ]; then
echo "$dotfile Done!"
fi
break
done
exit 0
done