LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 07-09-2013, 03:41 AM   #1
xeechou
Member
 
Registered: Jun 2013
Location: China
Distribution: Archlinux
Posts: 67

Rep: Reputation: Disabled
Where all these variables stored?


I type in "set" and "env" command and find those variables but they are not setted in ~/.bash_profile so I suppose those things was configed in somewhere in /etc/.
Am I right?
I am new to bash.
 
Old 07-09-2013, 03:47 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
There are more places bash looks when you start a bash shell.

- Execution sequence for .bash_profile, .bashrc, .bash_login, .profile and .bash_logout

Also have a look at the INVOCATION section in the bash manual page (man bash). Here's a summary: Bash Startup Files
 
Old 07-09-2013, 04:09 AM   #3
xeechou
Member
 
Registered: Jun 2013
Location: China
Distribution: Archlinux
Posts: 67

Original Poster
Rep: Reputation: Disabled
re:drunna

Quote:
Originally Posted by druuna View Post
There are more places bash looks when you start a bash shell.

- Execution sequence for .bash_profile, .bashrc, .bash_login, .profile and .bash_logout

Also have a look at the INVOCATION section in the bash manual page (man bash). Here's a summary: Bash Startup Files

Code:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
My .bash_profile simply contains this line, what does the "-f" and "." after then means?
 
Old 07-09-2013, 04:19 AM   #4
mddnix
Member
 
Registered: Mar 2013
Location: Bangalore, India
Distribution: Redhat, Arch, Ubuntu
Posts: 506

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by xeechou View Post
Code:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
It means if there is a file called .bashrc in user's home folder, then source it.

source it - means run commands in that script, but instead creating a new subshell, execute them in present shell. so whatever you have set in script are now available to current shell (something like logout-login or refresh).

-f = if file exists
. = sourcing (you can also use 'source' instead of '.' both are same)

Last edited by mddnix; 07-09-2013 at 04:27 AM.
 
Old 07-09-2013, 05:02 AM   #5
xeechou
Member
 
Registered: Jun 2013
Location: China
Distribution: Archlinux
Posts: 67

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by mddesai View Post
It means if there is a file called .bashrc in user's home folder, then source it.

source it - means run commands in that script, but instead creating a new subshell, execute them in present shell. so whatever you have set in script are now available to current shell (something like logout-login or refresh).

-f = if file exists
. = sourcing (you can also use 'source' instead of '.' both are same)

It looks that there are lots of parameters can be list in [conditions], like -f -z -n, does all these are parameters from command "test"?



Last edited by xeechou; 07-09-2013 at 05:03 AM.
 
Old 07-09-2013, 05:09 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Quote:
Originally Posted by xeechou View Post
It looks that there are lots of parameters can be list in [conditions], like -f -z -n, does all these are parameters from command "test"?
The test man page does tell you what these options do. They are also explained in the bash manual page (CONDITIONAL EXPRESSIONS section).
 
  


Reply

Tags
bash


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where are the PATH variables stored in? bdtagar Linux - Software 2 08-20-2010 09:47 AM
where are the variables stored in the kernel? shendeswanand Linux - Software 1 12-30-2005 03:14 PM
where are the environment variables stored? ojav Linux - Newbie 3 05-31-2005 05:00 PM
commands stored into variables? benne Programming 2 11-15-2004 08:20 PM
Where are variables permaninently stored? tearinox Linux - General 4 06-05-2004 11:42 AM


All times are GMT -5. The time now is 06:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration