Skip to content

Instantly share code, notes, and snippets.

@theory
Forked from miyagawa/gist:1368453
Created November 15, 2011 22:33
Show Gist options
  • Save theory/1368591 to your computer and use it in GitHub Desktop.
Save theory/1368591 to your computer and use it in GitHub Desktop.
#!/bin/sh
pwd=`pwd`
for i in dot.*
do
if [ -d "$i" ]
then
for j in `find $i -type file`
do
s=`echo $j | sed -e s/^dot//`
if [ -e "$HOME/$s" ]
then
mv $HOME/$s $HOME/$s.bak
else
b=`dirname $j`
mkdir -p $b
fi
ln -s $pwd/$j $HOME/$s
done
else
s=`echo $i | sed -e s/^dot//`
if [ -e "$HOME/$s" ]
then
mv $HOME/$s $HOME/$s.bak
fi
ln -s $pwd/$i $HOME/$s
fi
done
@theory
Copy link
Author

theory commented Mar 28, 2012

Ah, no problem, @noodles-v6. If you have files in the current directory starting with dot., they will be copied to your home directory without the dot.. For example, dot.emacs would become ~/.emacs.

@noodles-v6
Copy link

thanks, I got it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment