【发布时间】:2017-08-20 15:41:55
【问题描述】:
基本上,我正在尝试使用GNU Stow 轻松地将我的点文件/配置文件同步到我的主目录。每个配置都存储在相对于我的主目录的命名文件夹中。例如,vim/.vimrc 或 i3/.config/i3/config。其中一些文件夹有多个文件。
脚本
#!/usr/bin/env bash
# This script will Stow all the dotfiles located in the ~/dotfiles folder.
# The -R flag is used to force a 'restow' which will remove any existing symlinks before attempting to Stow.
echo "Stowing Dotfiles...";
cd ~/.dotfiles
for file in ~/dotfiles/*; do
# Only run Stow on the directories in the dotfiles folder and not the individual files.
# Using 'basename' strips the filepath from the directory name.
if [ -d ${file} ]; then
stow -R $(basename $file)
echo "$(basename $file) stowed.";
fi
done
# Return back to the your PWD from before you ran the script
cd ~-
echo 'All stowed';
当我运行此程序时,~/.config 文件夹中的某些文件或目录被存放。但是,如果文件存在,它似乎不会被收起。此外,我的主目录根目录中的文件似乎没有被存放,例如bash/.bashrc 和上述目录中的其他文件。
输出
Stowing Dotfiles...
stow_all.sh: line 8: cd: /home/devon/.dotfiles: No such file or directory
WARNING! unstowing bash would cause conflicts:
* existing target is neither a link nor a directory: .bash_aliases
* existing target is neither a link nor a directory: .bashrc
WARNING! stowing bash would cause conflicts:
* existing target is neither a link nor a directory: .bash_aliases
* existing target is neither a link nor a directory: .bashrc
All operations aborted.
bash stowed.
bin stowed.
compton stowed.
WARNING! unstowing fonts would cause conflicts:
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Bold Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Bold for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Light Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Light for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Medium Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Medium for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Thin Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Thin for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Bold.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-BoldItalic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Italic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Light.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-LightItalic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Medium.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-MediumItalic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Regular.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Thin.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-ThinItalic.ttf
WARNING! stowing fonts would cause conflicts:
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Bold Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Bold for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Light Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Light for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Medium Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Medium for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Thin Italic for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono Thin for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/Roboto Mono for Powerline.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Bold.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-BoldItalic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Italic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Light.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-LightItalic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Medium.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-MediumItalic.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Regular.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-Thin.ttf
* existing target is neither a link nor a directory: .local/share/fonts/RobotoMono-ThinItalic.ttf
All operations aborted.
fonts stowed.
WARNING! unstowing git would cause conflicts:
* existing target is neither a link nor a directory: .gitconfig
WARNING! stowing git would cause conflicts:
* existing target is neither a link nor a directory: .gitconfig
All operations aborted.
git stowed.
gtk stowed.
i3 stowed.
WARNING! unstowing ncmpcpp would cause conflicts:
* existing target is neither a link nor a directory: .config/ncmpcpp/config
WARNING! stowing ncmpcpp would cause conflicts:
* existing target is neither a link nor a directory: .config/ncmpcpp/config
All operations aborted.
ncmpcpp stowed.
WARNING! unstowing polybar would cause conflicts:
* existing target is neither a link nor a directory: .config/polybar/config
* existing target is neither a link nor a directory: .config/polybar/launch.sh
* existing target is neither a link nor a directory: .config/polybar/updates.sh
* existing target is neither a link nor a directory: .config/polybar/weather.py
WARNING! stowing polybar would cause conflicts:
* existing target is neither a link nor a directory: .config/polybar/config
* existing target is neither a link nor a directory: .config/polybar/launch.sh
* existing target is neither a link nor a directory: .config/polybar/updates.sh
* existing target is neither a link nor a directory: .config/polybar/weather.py
All operations aborted.
polybar stowed.
ranger stowed.
sound stowed.
WARNING! unstowing termite would cause conflicts:
* existing target is neither a link nor a directory: .config/termite/config
WARNING! stowing termite would cause conflicts:
* existing target is neither a link nor a directory: .config/termite/config
All operations aborted.
termite stowed.
WARNING! unstowing tmux would cause conflicts:
* existing target is neither a link nor a directory: .tmux.conf
WARNING! stowing tmux would cause conflicts:
* existing target is neither a link nor a directory: .tmux.conf
All operations aborted.
tmux stowed.
WARNING! unstowing vim would cause conflicts:
* existing target is neither a link nor a directory: .tern-config
* existing target is neither a link nor a directory: .vimrc
WARNING! stowing vim would cause conflicts:
* existing target is neither a link nor a directory: .tern-config
* existing target is neither a link nor a directory: .vimrc
All operations aborted.
vim stowed.
WARNING! unstowing xorg would cause conflicts:
* existing target is neither a link nor a directory: .Xresources
* existing target is neither a link nor a directory: .xinitrc
WARNING! stowing xorg would cause conflicts:
* existing target is neither a link nor a directory: .Xresources
* existing target is neither a link nor a directory: .xinitrc
All operations aborted.
xorg stowed.
All stowed
【问题讨论】:
-
如果我的回答帮助你解决了你的问题,不妨考虑接受我的回答
标签: linux bash config symlink dotfiles