2013-12-20 1 views
1

찾을 수 있습니다. 내 도트 파일에 this one이 있습니다. 하지만 저자가 왜 dotfiles_old를 만드는 지 이해할 수 없습니다. 대신 점 파일로 이동하십시오.도트 파일을 만들 때 dotfiles_old가 필요한 이유

Q1. 그럴만한 이유가 있습니까? 그렇다면 왜?

2. dofiles_old없이 할 수 있습니까? 좋은 생각인가?

미리 감사드립니다. 당신이 당신의 새로운 공상 프롬프트 ~/dotfiles/bashrc를 업데이트하는 것을 잊었다는 것을 발견하는 경우 ~/dotfiles_old

#!/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 vimrc vim zshrc oh-my-zsh" # list of files/folders to symlink in homedir 

########## 

# create dotfiles_old in homedir 
echo "Creating $olddir for backup of any existing dotfiles in ~" 
mkdir -p $olddir 
echo "...done" 

# change to the dotfiles directory 
echo "Changing to the $dir directory" 
cd $dir 
echo "...done" 

# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks 
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 

답변

1

, 당신은 ~/dotfiles_old/.bashrc에서 복사 만 할 수 있습니다.

~/dotfiles_old이 없으면 홈 디렉토리에서 변경 한 내용이 영구적으로 손실됩니다.

전적으로 걱정할 필요가 없습니다. 그것은 스크립트가 아닌 사용자의 이익을위한 것입니다.

1

가장 좋은 방법은 $ HOME에 폴더 dotfiles를 만들고 해당 구성 파일에 대한 심볼릭 링크를 만드는 것입니다. https://github.com/vsouza/dotfiles

각 폴더에 심볼릭 링크를 만드는 돌봐 install.sh 파일이 있습니다 :

여기에 예를 되세요.

관련 문제