我有以下内容:
if [ $kernel == 'Darwin' ]; then
$HOME="/Users/$user"
elif [ $kernel == 'Linux' ]; then
$HOME="/home/$user"
fi
# Let the script know what the dotfiles dir is
dotfiles_dir="$HOME/dotfiles"
# Making symlinks to shell files, add yours as you need
echo 'Making symlinks to shell files'
ln -sfn -v $dotfiles_dir/shells/zsh $HOME/.zsh
ln -sfn -v $dotfiles_dir/shells/zsh/zshrc $HOME/.zshrc
ln -sfn -v $dotfiles_dir/shells/bash $HOME/.bash
ln -sfn -v $dotfiles_dir/shells/bash/bash_profile $HOME/.bash_profile
ln -sfn -v $dotfiles_dir/shells/bash/bashrc $HOME/.bashrc
ln -sfn -v $dotfiles_dir/shells/profile $HOME/.profile
echo "Done at [$time]...\n"
然而,这奇怪地输出:
[Other output here...]
Making symlinks shell files
/Users/eduan/.zsh -> /Users/eduan/dotfiles/shells/zsh
/Users/eduan/.zshrc -> /Users/eduan/dotfiles/shells/zsh/zshrc
/Users/eduan/.bash -> /Users/eduan/dotfiles/shells/bash
./bashrc -> /Users/eduan/dotfiles/shells/bash/bashrc
/Users/eduan/.profile -> /Users/eduan/dotfiles/shells/profile
Done at [08:15]...
[Other output here...]
谁能告诉我为什么我会得到这个意外的输出?我的其他符号链接生成正确,但是 Bash 符号链接由于某种原因被弄乱了。
顺便说一句,这是一个生成符号链接的大脚本。这只是其中的一部分,我把相关部分放在了上面,以免你感到困惑。:)
编辑:
这是脚本最新版本的链接:https ://github.com/Greduan/dotfiles/blob/master/scripts/make_symlinks.sh