I have run into an issue when executing script in /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. However, when I run terminal and type echo $BASH_VERSION, it is filled correctly.
I run this on Ubuntu 16.04.1.
Do you have any ideas why is this variable empty during execution of /etc/profile.d/ scripts?
SHELLis not necessarily the name of the current shell; it's the name of your login shell. The scripts in/etc/profile.dmay be executed by/bin/sh, which isdashin Ubuntu.