Forums | MacLife

You are not logged in.

#1 2003-01-14 9:53 pm

smd3
Member
Registered: 2002-10-24
Posts: 385

.files

I changed my prompt using netinfo manager  to bash. It won't execute the .bashrc file I have in ~. When I try to force it using --rcfile the terminal window opens saying it can't find the file. Permissions should be good, I'm the owner and I even tried setting it 777.

has anyone done anything like this?


I'm also looking for x11.app's version of .xinitrc. It doesn't execute the one in /etc/X11/xinit/, it will execute it if I put it in ~/.xinitrc, but it's a little quirky. If I change twm to quartz-wm it won't exec anything else. (xclock, xterm's for example.)

Offline

 

#2 2003-01-14 10:18 pm

Fracai
Evacipate
From: St. Elsewhere
Registered: 2000-05-25
Posts: 2702

Re: .files

try a .bash_profile

there's another .bash file but I can't remember the name.

only thing I can think of is to delete the .bashrc and create a new one.


   i am jack's amusing sig file
        http://homepage.mac.com/fracai/p/s.png
Satellite Lot :: Second Summer

Offline

 

#3 2003-01-15 11:58 pm

[MA] Flying_Meat
Member
From: Frisco?
Registered: 2001-03-31
Posts: 8355

Re: .files

Ok, just to nitpick with rekless abandon, you did in fact change the prompt you normally see, but only because, what you DID was change your default shell. It's a very important troubleshooting point (in my defense wink )

I believe that "traditionally", the .bashrc is sourced from .bash_profile

Here is what my .bash_profile looks like:

Code:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:$HOME:.
BASH_ENV=$HOME/.bashrc
USERNAME=""
export USERNAME BASH_ENV PATH

The "if" statement is where the sourcing occurs.


...and watch out for the flying meat!

Offline

 

#4 2003-01-16 9:55 am

thekingalrock
Please tell me what the hell is going on
From: MA
Registered: 2001-04-01
Posts: 5072

Re: .files

The other bash file is .bash_login


It places the lotion in the basket

Offline

 

#5 2003-01-16 12:39 pm

Fracai
Evacipate
From: St. Elsewhere
Registered: 2000-05-25
Posts: 2702

Re: .files

RIGHT!

thanks.

do you remember the order that these files are checked?


   i am jack's amusing sig file
        http://homepage.mac.com/fracai/p/s.png
Satellite Lot :: Second Summer

Offline

 

#6 2003-01-19 12:56 am

[MA] Flying_Meat
Member
From: Frisco?
Registered: 2001-03-31
Posts: 8355

Re: .files

I would guess that the login file is checked immediately if it exists (doesn't on my machine) since it's presumably responsible for login actions.

My next highly untrained guess is the profile is checked next since it checks for, then "sources" the rc file.

All guess work, and as such, may be completely backward wink

seems to me the order is described in a man page somewhere.
EUREKA!

Code:

       The following paragraphs describe how  bash  executes  its
       startup  files.   If  any of the files exist but cannot be
       read, bash reports an error.  Tildes are expanded in  file
       names  as  described  below  under  Tilde Expansion in the
       EXPANSION section.

       When bash is invoked as an interactive login shell, or  as
       a  non-interactive shell with the --login option, it first
       reads and executes commands from the file /etc/profile, if
       that  file  exists.  After reading that file, it looks for
       ~/.bash_profile, ~/.bash_login, and  ~/.profile,  in  that
       order,  and reads and executes commands from the first one
       that exists and is readable.  The --noprofile  option  may
       be  used  when the shell is started to inhibit this behav-
       ior.

       When a login shell exits, bash reads and executes commands
       from the file ~/.bash_logout, if it exists.

       When  an  interactive  shell  that is not a login shell is
       started, bash reads and executes commands from  ~/.bashrc,
       if  that  file exists.  This may be inhibited by using the
       --norc option.  The --rcfile file option will  force  bash
       to   read  and  execute  commands  from  file  instead  of
       ~/.bashrc.

       When bash is started non-interactively,  to  run  a  shell
       script, for example, it looks for the variable BASH_ENV in
       the environment, expands its value if  it  appears  there,
       and  uses the expanded value as the name of a file to read
       and execute.  Bash behaves as  if  the  following  command
       were executed:
              if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
       but  the  value of the PATH variable is not used to search
       for the file name.

etc...

From the "man bash" command (<---hmmmm) you can type "/" and then a word to search for.
I typed ".bash_profile" as my search term and was delivered to that section-ish.

Man pages are your friend  big_smile


...and watch out for the flying meat!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson