Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-05-2016, 03:07 AM
|
#1
|
Member
Registered: Aug 2015
Posts: 257
Rep: 
|
no value for environment variable when reboot pc
I have added a line in /etc/profile
Code:
export SMARTY_DIR=/usr/local/lib/Smarty/
`echo $SMARTY_DIR` can get value `/usr/local/lib/Smarty/` after `source /etc/profile`.
When to reboot my pc ,`echo $SMARTY_DIR` can get nothing.
What is the matter for my bash configure?
|
|
|
11-05-2016, 07:23 AM
|
#2
|
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,042
|
|
|
|
11-05-2016, 12:50 PM
|
#3
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
Quote:
Originally Posted by luofeiyu
`echo $SMARTY_DIR` can get value `/usr/local/lib/Smarty/` after `source /etc/profile`.
When to reboot my pc ,`echo $SMARTY_DIR` can get nothing.
|
which distro, which bash version?
as which user are you sourcing /etc/profile, and echoing the variable?
is /etc/profile sourced during boot?
|
|
|
11-15-2016, 06:51 PM
|
#4
|
Member
Registered: Aug 2015
Posts: 257
Original Poster
Rep: 
|
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.
|
|
|
11-15-2016, 06:58 PM
|
#5
|
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,222
|
just add it to ~/.bashrc
|
|
|
11-15-2016, 08:58 PM
|
#6
|
Member
Registered: Aug 2015
Posts: 257
Original Poster
Rep: 
|
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/
Last edited by luofeiyu; 11-16-2016 at 08:08 PM.
|
|
|
11-16-2016, 04:07 AM
|
#7
|
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,222
|
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 04:05 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|