问题现象:
rc.local文件配置source命令执行的脚本 服务器重启后不生效
发现执行docker命令还是没有提示
[root@reg ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
source /usr/share/bash-completion/bash_completion
[root@reg ~]#
解决:
将source执行的脚本命令 追加写入 ~/.bashrc配置文件
echo "source /usr/share/bash-completion/bash_completion" >> ~/.bashrc
效果:
[root@reg ~]# docker lo
load login logout logs
[root@reg ~]# docker lo
load login logout logs
[root@reg ~]# docker ex
exec export