Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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?

like image 251
synek317 Avatar asked Apr 29 '26 04:04

synek317


1 Answers

By definition, /etc/profile.d scripts are not run by Bash.

like image 155
tripleee Avatar answered Apr 30 '26 21:04

tripleee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!