You are not logged in.

#1 2006-04-06 22:33:50

riwa
Member
From: Lund, Sweden
Registered: 2006-04-04
Posts: 215

Writing a bash.bashrc?

In debian and ubuntu you could have a file called bash.bashrc in /etc which (I think) was the only file launched when a terminal instance is launched. You usually (it's normally configured during install) set it to look for a ~/.bashrc and launches it if it's there. Can I do that in Arch? What do I need to have it executing?

Will this little "if" clause do it (my bash isn't very good :oops: ).

if [ -x "~/.bashrc" ]; then
        bash ~/.bashrc
fi

/Richard


If you must have must. Have must.
- DKE supporters about this wonderful swedish soda.

Offline

#2 2006-04-06 23:50:28

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Writing a bash.bashrc?

~/.bashrc is always loaded by bash if it is a login shell.  No need to include that at a global level, just make sure you're using a login shell.

Offline

#3 2006-04-07 00:14:32

riwa
Member
From: Lund, Sweden
Registered: 2006-04-04
Posts: 215

Re: Writing a bash.bashrc?

But will my bash.bashrc also be loaded? I need to set TERM=xterm and don't want to have to do it in every .bashrc file on the system.


If you must have must. Have must.
- DKE supporters about this wonderful swedish soda.

Offline

#4 2006-04-07 00:49:15

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Writing a bash.bashrc?

If you're concerned about new accounts and not having to re-create your settings for each person's </code>~/.bashrc</code>, then just alter the skeleton file in <code>/etc/skel/.bashrc</code> and that will get copied over whenever a new account is created.

If you're worried about previously made accounts, you could handle it a number of ways, but the easiest would probably be a shell script.  AFAIK, I don't think there's a globally loaded bashrc file, but I could be wrong.

Offline

#5 2006-04-07 02:09:29

riwa
Member
From: Lund, Sweden
Registered: 2006-04-04
Posts: 215

Re: Writing a bash.bashrc?

Nice! I didn't know about that skel thing. I guess the problems solved then, don't really have that many accounts. Still I'm pretty sure there was a global bashrc in ubuntu. Well thanks anyway!

/Richard


If you must have must. Have must.
- DKE supporters about this wonderful swedish soda.

Offline

#6 2006-04-07 02:16:41

SleepyDog
Member
Registered: 2004-10-15
Posts: 114

Re: Writing a bash.bashrc?

You can test to see if X is running in /etc/profile and set it there, I suppose. The .bashrc way is cleaner, though. Doesn't matter, anything dealing with terminfo is bound to be a mess.

Offline

#7 2006-04-07 15:50:48

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Writing a bash.bashrc?

Please note it's a terrible idea to set the TERM environment variable.  You're trudging into terminfo-land, and no one vacations there.

It is best to leave the term value at the default the terminal uses.  If that is a problem (i.e. in the case of xterm/xterm-color), you should set the value via the 'termName' X resource (xterm*termName: xterm-256color, in ~/.Xdefaults)

Offline

#8 2006-04-07 19:39:43

riwa
Member
From: Lund, Sweden
Registered: 2006-04-04
Posts: 215

Re: Writing a bash.bashrc?

PLease be more specific. I just set TERM=xterm in my /etc/profile. I got an error message before so i had to do it. What's my better option?


If you must have must. Have must.
- DKE supporters about this wonderful swedish soda.

Offline

#9 2006-04-08 00:58:00

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Writing a bash.bashrc?

riwa wrote:

PLease be more specific. I just set TERM=xterm in my /etc/profile. I got an error message before so i had to do it. What's my better option?

phrakture wrote:

you should set the value via the 'termName' X resource (xterm*termName: xterm-256color, in ~/.Xdefaults)

Offline

Board footer

Powered by FluxBB