-
-
Save theory/1368591 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: What?
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
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
.
thanks, I got it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what happen :
for i in dot.*
thanks