Created
July 8, 2024 12:28
A script to symlink and move dotfiles to another directory (that can then be put under git!)
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
# 🌟🐺 -=: makesymlinks.sh :=- | |
# I got this base script from someone else's dotfiles, but can't remember who. Shoutz out to that guy for this. | |
#!/bin/bash | |
############################ | |
# .make.sh | |
# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles | |
############################ | |
########## Variables | |
dir=~/dotfiles # dotfiles directory | |
olddir=~/dotfiles_old # old dotfiles backup directory | |
files="bashrc config vimrc vim zshrc p10k oh-my-zsh private scrotwm.conf Xresources" # list of files/folders to symlink in homedir | |
########## | |
# create dotfiles_old in homedir | |
echo -n "Creating $olddir for backup of any existing dotfiles in ~ ..." | |
mkdir -p $olddir | |
echo "done" | |
# change to the dotfiles directory | |
echo -n "Changing to the $dir directory ..." | |
cd $dir | |
echo "done" | |
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks from the homedir to any files in the ~/dotfiles directory specified in $files | |
for file in $files; do | |
echo "Moving any existing dotfiles from ~ to $olddir" | |
mv ~/.$file ~/dotfiles_old/ | |
echo "Creating symlink to $file in home directory." | |
ln -s $dir/$file ~/.$file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment