dircolors:没有 SHELL 环境变量,也没有给出 shell 类型选项

Let*_*t4U 5 debian virtual-machines openvz debian-wheezy

在交互式登录时,我得到:

dircolors: no SHELL environment variable, and no shell type option given
Run Code Online (Sandbox Code Playgroud)

但我确实设置了 SHELL 变量:

% set | grep SHELL
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
Run Code Online (Sandbox Code Playgroud)

~/.bash_profile我这样的来源.dircolors

eval "`dircolors ~/.dircolors`"
Run Code Online (Sandbox Code Playgroud)

我已经在其他 Linux 主机上这样做了,这从来都不是问题,但是当我这样做时vzctl enter $CTID(带有 Debian wheezy 的 OpenVZ 容器),这总是出现。

为什么要这样做?我该如何解决?

小智 2

尝试使用检查环境变量env,看看该SHELL变量是否存在。

set还可以看到 shell 局部变量,这些变量只能由当前 shell 访问,而不能由每个执行的程序访问 [ 1 ]

如果SHELL变量不存在,您可以使用导出它export SHELL