LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 02:41 AM   #1
v3ct0r
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, 02:47 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 03:09 AM   #3
v3ct0r
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, 03:19 AM   #4
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

Rep: Reputation: 153Reputation: 153
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 Madhu Desai; 07-09-2013 at 03:27 AM.
 
Old 07-09-2013, 04:02 AM   #5
v3ct0r
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 v3ct0r; 07-09-2013 at 04:03 AM.
 
Old 07-09-2013, 04:09 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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



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 08:47 AM
where are the variables stored in the kernel? shendeswanand Linux - Software 1 12-30-2005 02:14 PM
where are the environment variables stored? ojav Linux - Newbie 3 05-31-2005 04:00 PM
commands stored into variables? benne Programming 2 11-15-2004 07:20 PM
Where are variables permaninently stored? tearinox Linux - General 4 06-05-2004 10:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:09 PM.

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
Open Source Consulting | Domain Registration