Skip to content

Instantly share code, notes, and snippets.

@qiukun
Created February 15, 2013 06:33
Show Gist options
  • Save qiukun/4958852 to your computer and use it in GitHub Desktop.
Save qiukun/4958852 to your computer and use it in GitHub Desktop.
文件不要带 . ln 过去的时候会加上 . 的
#!/bin/sh
cd `dirname $0`
F=`pwd |sed -e "s#$HOME/\?##"`
for P in *
do
# skip setup
if [ "$P" = "setup.sh" ]; then continue; fi
# ensure permissions
chmod -R o-rwx,g-rwx $P
# skip existing links
if [ -h "$HOME/.$P" ]; then continue; fi
# move existing dir out of the way
if [ -e "$HOME/.$P" ]; then
rm -rf "$HOME/.$P"
fi
# create link
echo -n "Link "
ln -v -s "$F/$P" "$HOME/.$P"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment