因为丢失文件导致的
1、.bash_profile
2、.bashrc
#!/usr/bin/env bash
__main() {
if [[ "$(grep -v '^$' </root/.bash_profile 2>/dev/null | grep -v '^export' | grep -v '^#' | grep -v '^PATH')" == "" ]]; then
cat >/root/.bash_profile <<"EOF"
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
EOF
fi
if [[ "$(grep -v '^$' </root/.bashrc 2>/dev/null | grep -v '^export' | grep -v '^#' | grep -v '^PATH')" == "" ]]; then
cat >/root/.bashrc <<"EOF"
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
EOF
fi
}
__main
设置好以后重新连接到终端即可