no value for environment variable when reboot pc
I have added a line in /etc/profile
Code:
export SMARTY_DIR=/usr/local/lib/Smarty/ When to reboot my pc ,`echo $SMARTY_DIR` can get nothing. What is the matter for my bash configure? |
|
Quote:
as which user are you sourcing /etc/profile, and echoing the variable? is /etc/profile sourced during boot? |
debian8 is the normal account name.
debian8@hwy:~$ bash --version GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. debian8@hwy:~$ uname -a Linux hwy 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux debian8@hwy:~$ source /etc/profile debian8@hwy:~$ echo $SMARTY_DIR /usr/local/lib/Smarty/ `/etc/profile` not sourced during boot. After reboot and input echo $SMARTY_DIR on account name ----debian8,nothing get. |
just add it to ~/.bashrc
|
I got the answer in http://unix.stackexchange.com/questi...on-login-shell
A shell started in a new terminal in a GUI would be an interactive non-login shell. It would source your .bashrc, but not your .profile, for example. It is the best way to add the following line both in /etc/profile(for login shell) and /etc/bash.bashrc(for non-login shell) for my debian. Code:
export SMARTY_DIR=/usr/local/lib/Smarty/ |
the files in /etc are really for global/root use though they can of course be used by any user, you are much better using the corresponding files in your home folder
|
All times are GMT -5. The time now is 03:00 AM. |