Create unpack script and move dotfiles to files/ dir.
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.swp
|
||||||
26
unpack.sh
Normal file
26
unpack.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script will create symlinks for every dotfile in this repo to the $HOME
|
||||||
|
# directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
dotfiles=$(find ./files -type f -name '\.*')
|
||||||
|
dir=$(pwd)
|
||||||
|
echo "Creating soft links to $dir..."
|
||||||
|
for file in $dotfiles;
|
||||||
|
do
|
||||||
|
name=$(basename $file)
|
||||||
|
echo " $name"
|
||||||
|
if [ -a "$HOME/$name" ]
|
||||||
|
then
|
||||||
|
read -p "$HOME/$name exists. Would you like to overwrite it? (y/n): " yn
|
||||||
|
case $yn in
|
||||||
|
[Yy]* )
|
||||||
|
rm "$HOME/$name";;
|
||||||
|
* )
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
ln -s -t $HOME "$dir/$file"
|
||||||
|
done
|
||||||
|
echo "done"
|
||||||
Reference in New Issue
Block a user