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
#!/bin/bash | |
# coming-home: configure home-dir with your dotfiles | |
# Copyright: (C) 2010 Florian Baumann <flo@noqqe.de> | |
# License: GPL3 <http://gnu.org/licenses/gpl-3.0.txt> | |
# get dotfiles | |
dotfiles=$(ls -la | grep -v ^d | awk '{print $8}'| grep -v ^coming-home.bash$ ) | |
mode=${1:-normal} | |
for x in $dotfiles; do | |
# fishing errors | |
if [ ! -e $x ] ; then echo "error reading files" ; exit 1 ; fi | |
# keep old .bashrc | |
if [ $x = ".bashrc" ]; then | |
if [ ! -e $HOME/.bashrc_old ]; then | |
cp $HOME/.bashrc $HOME/.bashrc_old | |
fi | |
fi | |
# forced hook | |
if [ $mode = "--hook" ]; then echo "hook: copying $x" ; /bin/cp -r $x $HOME/ ; fi | |
# standard run | |
if [ $mode != "--hook" ]; then /bin/cp -i $x $HOME/ ; fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment