简体   繁体   English

即使SHELL是/ bin / bash,BASH_VERSION也为空

[英]BASH_VERSION is empty even though SHELL is /bin/bash

I have run into an issue when executing script in /etc/profile.d/script.sh. 在/etc/profile.d/script.sh中执行脚本时遇到问题。 On one of my machines (only this one, on the others it is running well), when I do 在我的一台机器上(只有一台机器,在其他机器上运行良好)

echo "$BASH_VERSION" >> /home/synek317/log
echo "$SHELL"        >> /home/synek317/log

the result is that BASH_VERSION is empty, but SHELL is /bin/bash . 结果是BASH_VERSION为空,而SHELL/bin/bash However, when I run terminal and type echo $BASH_VERSION , it is filled correctly. 但是,当我运行终端并键入echo $BASH_VERSION ,它将正确填充。

I run this on Ubuntu 16.04.1. 我在Ubuntu 16.04.1。

Do you have any ideas why is this variable empty during execution of /etc/profile.d/ scripts? 您有什么主意,为什么在执行/etc/profile.d/脚本时此变量为空?

根据定义,/ /etc/profile.d脚本不是由Bash运行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM