Re: bash scripts and files
- From: Tyler Smith <tyler.smith@xxxxxxxxxxxxxx>
- Date: 31 Dec 2007 18:51:45 GMT
On 2007-12-31, michael <cs@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Thanks, probably the previous chapter ("she-bang") was of more use
but a useful ref. However, I'm still trying to understand why it's
not usual to have a she-bang for the .bash_profile and .bashrc files.
That documentation reads as if it's expected - they are scripts and
contain shell specific syntax.
Regular shell scripts could be called from any number of places. If
you're running a bash shell, you could run a csh or zsh or python
script. Similarly any of these scripts could be called from another
process, such as from a program written in C, or Lisp, or whatever. In
any of these cases the language of the script has no relation to the
environment it is called from. All the caller knows is that they are
executable files - any details are hidden. That means the pertinent
information needs to be stored in the script itself, and that has to
happen on the first line so the proper interpreter is invoked.
Imagine what would happen if you didn't do this. You call a script
from your terminal running bash, and that script is written in Perl.
Without the #! the terminal could either assume it's written in bash,
and choke on the syntax, or try and guess the language, which gets
hairy very quickly.
.bashrc and .bash_profile are different. They are only reasonably
invoked by a bash shell, so it is safe to assume they are written
using bash syntax. They are, after all, configuration files for bash,
so what other language would they be written in?
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
- Prev by Date: Re: debian how-to
- Next by Date: Re: temperature problems
- Previous by thread: Re: bash scripts and files
- Next by thread: OOo window in fluxbox