On 4/20/00 00:06, Eddis JEfferson at [EMAIL PROTECTED] wrote:
>
>Thanks You!
>
>What is the difference between an interactive shell
>and a subshell?
>
Well, now one of the "regulars" here may jump in to correct me, but I
believe a good way to explain it is so:
When you log in, a shell starts. It could be an interactive shell that
offers you the command line, or it could launch you straight into X (a
graphic user environment). In either case, it is an interactive shell.
In the first case, you have chosen to interact with the shell directly
through the command line. In the second case, you have chosen (or your
administrator or Linux distributor has chosen) to interact with the shell
using an X server as an intermediary. Let's assume that you log in to an
interactive shell that offers you the command line rather than X (becasue
the explanation is "cleaner"). Using the command prompt, you can
"interact" with the shell, telling it to show you the date, start pine to
read your email or launch emacs to do some tweeking of your home page.
The interactive shell captures your commands and executes them, running
date, starting pine and waiting for it to finish and launching emacs and
waiting for you to exit out of it. It quite literally waits for you to
interact with it.
You launch a subshell when you run a script (for one, and perhaps the
most common, example). The interactive shell you are in captures your
call to `myscrpt.sh` and reading the "flash bang" line (the first line of
your script which probably reads #!/usr/bin/bash) and launches a subshell
to run the commands located in your script. When the commands in your
script are complete, the subshell exits, and your interactive shell
returns you to the command prompt, waiting for your next command.
Hope I haven't made this sound condescending, and I sincerely hope I
haven't led you TOO far astray.
Cheers,
Sean
>--- "T. Sean (Theo) Schulze" <[EMAIL PROTECTED]>
>wrote:
>> On 4/18/00 23:48, Eddis JEfferson at
>> [EMAIL PROTECTED] wrote:
>>
>> >
>> >In my studies of the startup files, I've
>> encountered
>> >the .profile and the .bashrc files. I understand
>> that
>> >there is a global one of each, and then there is a
>> >user one of each.
>> >
>> >What I don't understand is the purpose of the
>> .bashrc
>> >file. My documentation says it's for alias' and
>> for
>> >"functions". What is a function?? I suspect this
>> is
>> >getting into shell scripting...
>> >
>>
>> O'Reilly's "Learning the bash Shell" by Cameron
>> Newham and Bill
>> Rosenblatt, says that bash uses three files,
>> .bash_profile, .bashrc and
>> .bash_logout.
>>
>> .bash_profile (which can also be named .bash_login)
>> is executed when you
>> log in. When you log in, bash will first look for
>> .bash_profile. If it
>> doesn't find it, it will then look for .bash_login
>> and then .profile.
>> You can place commands you want to run when you
>> login in this file. For
>> example, if you wanted a calendar printed to the
>> screen, or fortune run,
>> or your schedule for the day displayed when you
>> first logged in, these
>> commands would go in .bash_profile. Note that the
>> Bourne shell also
>> reads its information from .profile. According to
>> the book, "a similar
>> approach was intended for .bash_login and the C
>> shell .login, but due to
>> differences in the basic syntax of the shells, this
>> is not a good idea."
>>
>> .bashrc is executed every time you start up a new
>> subshell. If you want
>> the same commands to run in your interactive shells
>> as run in your login
>> shell, you can use the source command within
>> .bash_profile to run your
>> .bashrc file.
>>
>> .bash_logout is read a login shell exits. An
>> example usage is to have
>> the screen clear as you log out, so that whoever
>> sits down afterward at
>> that terminal doesn't see a screen full of your
>> latest novel, or whatever.
>>
>> >It also said that some distro's forego the .bashrc
>> and
>> >put everything in the respective .profile file. So
>> I
>> >commented out my alias' (just one for color ls) and
>> >moved them to the ~/.profile file. Worked fine...
>>
>> On my SuSE 6.3 system, the default .bashrc says at
>> the top, "~/.bashrc is
>> read for interactive shells and ~/.profile is read
>> for login shells. We
>> just let ~/.profile also read ~/.bashrc and put
>> everything in ~/.bashrc."
>>
>>
>> >
>> >What then is the logic behind having a .bashrc
>> file?
>> >And what are rc files (run control if I'm correct)
>> >used for---there are rc files for x and kde and
>> other
>> >apps to. Are they running configuration files?
>> >
>>
>> Yes.
>>
>> >And maybe it's a Caldera thing---but why is roots
>> home
>> >directory outside the /home tree? Is this normal?
>> >
>>
>> On my SuSE system, root's home directory is /root.
>> I believe (although
>> it has been a while) that on my old NetBSD system,
>> root's home directory
>> was literally the root directory, /, but I am
>> probably wrong.
>>
>> Cheers,
>> Sean
>>
>>
>>
>> T. Sean (Theo) Schulze
>> [EMAIL PROTECTED] [EMAIL PROTECTED]
>> ****************************************************
>>
>> ...determines to remain actively seized of the
>> matter.
>>
T. Sean (Theo) Schulze [EMAIL PROTECTED]
Overheard in the Deep Ops Planning Cell:
"Yeah, but remember, Custer *died* in a 'target-rich environment'!"
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs