I have some questions regarding bash and my initializer files:
when I look at my bashrc file, I see lots of "export".. export MAGICK_HOME="$HOME/bin..etc".. what does export really mean?
in my bashrc, I have a line: "umask 0002" ... what does that do?
I have a bash_profile which apparently i not being called when I open a new terminal window in x11. (it has echo "welcome" stuff that I never see). Also in it, I have: if [ -f ~/.bashrc ]; then . ~/.bashrc fi --- what does that mean?.. Also, it has PATH=$HOME/bin:$PATH .. which my bashrc file also had PATH=... so, should only one of these files have path and export in it?
since my bash_profile wasn't being read, I added to my bashrc file (which is being read) . ~/.bash_profile ... when I opened a new window, my greeting message in bash_profile repeated over and over and over and over until I hit ctrl-c.. Why is it looping that?
As to point 4, you said in point 3 that your .bash_profile called .bashrc. So when you called your .bash_profile from your .bashrc, .bash_profile called .bashrc. And .bashrc called .bash_profile, which called....
Thank you for your reply.. Unfortunately reading those man entries did not explain anything to me. I just am not familiar with the terminology I guess..
Quote:
The supplied names are marked for automatic export to the environment of subsequently executed commands
What does that mean??? I read that paragraph 5 times and I have no idea what I am reading. Could you please give me some examples of what exporting does and how it's useful?
Quote:
The user file-creation mask is set to mode.
what is a "file-creation mask"? I googled this and the best I could find was that it sets the default permissions for a file.. But that umask line is set to 0002.. which is no permission I've ever seen before.. I'm used to seeing chmod 644, 755, 777, etc.. ?
Quote:
--noprofile
Do not read either the system-wide startup file /etc/profile or any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile. By default, bash reads these files when it is invoked as a login shell...
So, ok that made sense.. I realized that I needed to set x11 to do "xterm -ls" and that fixed it.
Quote:
As to point 4, you said in point 3 that your .bash_profile called .bashrc. So when you called your .bash_profile from your .bashrc, .bash_profile called .bashrc. And .bashrc called .bash_profile, which called....
Ok, so is it normal for bash_profile to call bashrc? Or should I remove that from my bashrc?
1. export: make sure that commands in subshells can read the exported variable.
2. umask: set default file permissions for new created files&directories; umask 002 means your default file permission is 664, and 775 for directories.
What does that mean??? I read that paragraph 5 times and I have no idea what I am reading. Could you please give me some examples of what exporting does and how it's useful?
Exporting a variable puts it into the environment so that child processes can see it.
If you set a variable in a script (script1), then call another script (script2), script2 will no know about the variable unless it has been exported.
Quote:
what is a "file-creation mask"? I googled this and the best I could find was that it sets the default permissions for a file.. But that umask line is set to 0002.. which is no permission I've ever seen before.. I'm used to seeing chmod 644, 755, 777, etc.. ?
It's a mask; in other words, if a bit is set in the mask, it will be turned off in a file when it is created.
Quote:
Ok, so is it normal for bash_profile to call bashrc? Or should I remove that from my bashrc?
It is common for .bash_profile to call .bashrc, which means that you do not want to call .bash_profile from .bashrc or you will get an infinite loop.
ok, thank you for the replies... I now understand export.. It's essentially making a variable global... Now my question is, in my bashrc I have:
What is the purpose of exporting these variables? What is referencing MANPATH, INFOPATH, MAGICK_HOME, DYLD_LIBRARY_PATH? Are these necessary to have? the test -r line.. I know that is something that my fink installer added-- so I guess I want that, but what does that mean exactly?
Quote:
umask: set default file permissions for new created files&directories; umask 002 means your default file permission is 664, and 775 for directories.
.. Ok-- so, if I don't have this umask 0002 line, what would my permissions be set to? Is it standard to have this line in your bashrc, and is 0002 the best thing to have it set to?
thank you very much for the help and explanations.
I am still learning shell scripting. Recently I see a function for read configuration. But some of special character make me confused. I checked online to find answer. It was not successful. I post the code here to consult with expert or guru to get better understanding on these special characters... (3 Replies)
Hi Folks,
I know on one side there is script and on another side there is smart script. I am able to achieve what I got but thought there has to be a code which doesn't require multiple lines. So if you guys can help me out than it will be awesome. Also I wrote in cshell but if can get both the... (4 Replies)
I have a text file called file1 which contains the text: "ls -l"
When I enter this command:
bash < file1 > file1
file1 gets erased. However if I enter this command:
bash < file1 > newfile
the output from "ls -l" is stored in newfile. My question is why doesn't file1's text ("ls -l") get... (3 Replies)
Hi again :)
I still need your help now...
#!/bin/bash
SIZE=`ls -s text.txt`
while
do
done
My problem is that the line "while ..." still print the same value after the first loop.
In one instruction change the size of text.txt
I've run my bash script in debug mode, and the... (6 Replies)
I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done.
I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and... (7 Replies)
Dear all,
I have been working with Linux for quite few years but never required to learn Bash and Linux really dep doan.
I want to learn bash I bought books and Have been reading on the Internet but I cannot find my answers, maybe I am blind.
For example:
What does this means?
# for i in... (4 Replies)
Hi, experts.
Whould anybody clear explay me difference and usage of these 3 commands (particulary in bash) :
exec
eval
source
I've tryed to read the manual pages but did not get much.
Also could not get something useful from Google search - just so much and so not exactly, that is... (3 Replies)
Ok, i've been trying to write some shell scripts. nothing challenging, but just automating
All of the tutorials i read say to start the file with
#!/bin/bash
or whatever your path to bash is.
So i do it, and all of my scripts error out saying ./nameofscript:command not found
when i... (4 Replies)