Skip to content

Instantly share code, notes, and snippets.

@theory
Forked from miyagawa/gist:1368453
Created November 15, 2011 22:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@noodles-v6
Copy link

what happen :
for i in dot.*

thanks

@theory
Copy link
Author

theory commented Mar 27, 2012

@noodles-v6: What?

@noodles-v6
Copy link

Sorry, I'm from China, and my English is that poor.

if I execute the follow gist, what is the output? ( my output is : dot.* )

pwd=pwd
for i in dot.*
do
echo $i
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