首頁  >  問答  >  主體

重新启动后echo $SMARTY_DIR 没有结果

debian8 是一个普通账户.

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:~$ 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>

我安装了Smarty到/usr/local/lib/Smarty/,于是写环境变量。

 vim /etc/profile
 export SMARTY_DIR=/usr/local/lib/Smarty/
 source /etc/profile

然后测试:

debian8@hwy:~$ echo $SMARTY_DIR
/usr/local/lib/Smarty/

现在关闭电脑,重新启动,进入普通账户debian8,再次输入

debian8@hwy:~$ echo $SMARTY_DIR

没有任何输出?请问,如何解决这个问题,出现故障的原因在哪里?


高洛峰高洛峰2893 天前681

全部回覆(1)我來回復

  • 三叔

    三叔2016-11-16 15:23:41

    建议把

    export SMARTY_DIR=/usr/local/lib/Smarty/

    写进 ~/.bashrc

    /etc/profile这个文件应该只影响sh,对bash的修改来自于/etc/bash.bashrc。你可以尝试一下修改/etc/bash.bashrc。不过修改~/.bashrc是更好的选择。


    回覆
    0
  • 取消回覆