Created
October 1, 2013 05:42
-
-
Save polamjag/6774311 to your computer and use it in GitHub Desktop.
このシェルスクリプトが存在するディレクトリ内の dotfiles のシンボリックリンクをホームディレクトリに貼るスクリプト
shell script to create symbolic link of "dotfiles" in which same directory with this script to your home directory. also handles directory whose name starts with dot.
This file contains 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
#!/usr/bin/sh | |
# symlinker.sh | |
# shell script to create symbolic link of "dotfiles" in which same directory with this script to your home directory. also handles directory whose name starts with dot. | |
# NOTICE: this script processes only files whose name begin with . (dot) | |
# | |
# polamjag <indirectgeeks@gmail.com> | |
# license: public domain | |
echo -e "creating symbolic link of dotfiles..." | |
shdir="$(cd $(dirname $0) && pwd)" | |
cd ${shdir} | |
for filepath in ${shdir}/.* | |
do | |
if [ \( -f $filepath -o -d $filepath \) -a $filepath != "${shdir}/." -a $filepath != "${shdir}/.." -a $filepath != "${shdir}/.git" ] ; then | |
echo "creating link: ${filepath} -> ${HOME}" | |
ln -s ${filepath} ${HOME} | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment