LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-01-2005, 11:45 PM   #1
Kanaflloric
Member
 
Registered: Jun 2004
Location: Canada
Distribution: Slackware 10.0
Posts: 80

Rep: Reputation: 15
where is bashrc ?


Hi

I don't know if it is a slackware related topic.

When I was with red hat, i had a script named .bashrc in my home directory. It was useful for user specific stuff...

Now, i am with slackware. There's no more .bashrc in the user's directory. I tried to add it myself, but it doesn't seem to work.

And by the way, where/when are loaded the messages that appear each time i log in ?

Thanks for any hint.
 
Old 09-01-2005, 11:59 PM   #2
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
There's no .bashrc file by default, if you need it you can create it.

Those messages are loaded by fortune, a little program included with bsd-games packages. It's run from /etc/profile.d/bsd-games-login-fortune.sh which is called by /etc/profile
 
Old 09-02-2005, 08:54 AM   #3
Kanaflloric
Member
 
Registered: Jun 2004
Location: Canada
Distribution: Slackware 10.0
Posts: 80

Original Poster
Rep: Reputation: 15
thank you.
 
Old 09-02-2005, 09:19 AM   #4
piete
Member
 
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465

Rep: Reputation: 44
Here are some good references when it comes to the bash startup files:

http://www.network-theory.co.uk/docs...ashref_56.html

http://sun.uni-regensburg.de/bash-1....atures_22.html

I found that some terminal emulators fail to deal with bash startup files properly, specifically the older versions of xfterm (xfce). I built a work around by jiggering the order in which they sourced each other, which also fixed the problem of su'ing (su, not su - ) and loosing that users environment variables set in /etc/bashrc. Off the top of my head, however, I cannot recall the order and don't want to complicate the issue by getting it wrong =)

- Piete.

PS: Oooh, in order to find out what's going on when you a) login and b) open up a new terminal - you can always add a line similar to (unchecked for errors): `ps --$$`
That should print out the currently running file. If you add it to all the bash startup files, you can check the order of them =)
 
Old 10-05-2007, 07:14 AM   #5
Cyhaxor
Member
 
Registered: Nov 2004
Location: UK
Distribution: Fedora 12
Posts: 129

Rep: Reputation: 15
sorry but what do you mean by telling you can create it? By just creating a .bashrc and make it executable, placed it in ~/home/ and write in the source code is gona work?
 
Old 10-05-2007, 07:40 AM   #6
Pau Gasol
Member
 
Registered: Jan 2006
Distribution: Debian Lenny, Slackware 12
Posts: 33

Rep: Reputation: 15
Quote:
what do you mean by telling you can create it? By just creating a .bashrc and make it executable, placed it in ~/home/ and write in the source code is gona work?
Mine worked that way
 
Old 10-05-2007, 07:59 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,044
Blog Entries: 1

Rep: Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370
Quote:
Originally Posted by Cyhaxor View Post
sorry but what do you mean by telling you can create it? By just creating a .bashrc and make it executable, placed it in ~/home/ and write in the source code is gona work?
Hi,

You don't need to make the file executable.

From the 'man bash';

Code:
excerpt 'man bash'

 When bash is invoked as an interactive login shell, or as a
 on-inter-active 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 behavior.
Very simply create a '.bashrc' and '.bash_profile' in your home directory using your favorite editor. An example for a 'bashrc';

Code:
#.bashrc
#08-30-06 12:20 gws copied loki:/root
#
#06-27-07 13:06 gws added from odin for willi
#
# Add bin to path
export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"

#export PATH="$PATH:$HOME/bin"

# Dynamic resizing
shopt -s checkwinsize

# Custom prompt
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#08-29-06 11:40 gws

if [ `id -un` = root ]; then
   PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
 else
   PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
fi
#
# Add color
eval `dircolors -b`

# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias lsp='ls -1 /var/log/packages/ > package-list'
alias na='nano'
alias web='links -g -download-dir ~/ www.google.com'

#08-29-06 11:50 gws

#To clean up and cover your tracks once you log off
#Depending on your version of BASH, you might have to use
# the other form of this command
   trap "rm -f ~$LOGNAME/.bash_history" 0

#The older KSH-style form
#   trap 0 rm -f ~$LOGNAME/.bash_history
An example of '.bash_profile';

Code:
# .bash_profile
#08-30-06 12:21 gws copied loki:/root
#06-27-07 13:10 gws copied from odin for willi
#
# Source .bashrc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
Very useful!

Last edited by onebuck; 10-05-2007 at 08:07 AM. Reason: format code window
 
1 members found this post helpful.
Old 10-05-2007, 11:29 AM   #8
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Why to use .bashrc when there is .bash_profile? As it is seen from the manual, .bashrc is not even a standard.
 
Old 10-05-2007, 03:48 PM   #9
Fidori
LQ Newbie
 
Registered: Oct 2007
Location: Finland
Distribution: Slackware
Posts: 24

Rep: Reputation: 8
.bash_profile is read and executed only by the login shell. Subshells use .bashrc .
 
Old 10-05-2007, 08:17 PM   #10
Cyhaxor
Member
 
Registered: Nov 2004
Location: UK
Distribution: Fedora 12
Posts: 129

Rep: Reputation: 15
thanks a lot for the info guys. I need this file to configure some proxies for my shell For the root user the default directory to add this file is etc/ ?
 
Old 10-06-2007, 02:18 AM   #11
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Quote:
Originally Posted by Fidori View Post
.bash_profile is read and executed only by the login shell. Subshells use .bashrc .
Yes, but environmental variables are already set using .bash_profile when you login. .bashrc is used only for colouring and bash specific settings. Using .bashrc for login scripts and setting system wide variables is wrong.

Last edited by Alien_Hominid; 10-06-2007 at 02:58 AM.
 
Old 10-06-2007, 02:43 AM   #12
Pau Gasol
Member
 
Registered: Jan 2006
Distribution: Debian Lenny, Slackware 12
Posts: 33

Rep: Reputation: 15
Quote:
Originally Posted by Cyhaxor View Post
thanks a lot for the info guys. I need this file to configure some proxies for my shell For the root user the default directory to add this file is etc/ ?
use it in /root/, mine is /root/.bashrc
 
Old 10-06-2007, 02:47 PM   #13
Cyhaxor
Member
 
Registered: Nov 2004
Location: UK
Distribution: Fedora 12
Posts: 129

Rep: Reputation: 15
ok thanks! my main goal is to configure bash proxies. Thats why I ask for the root account! Thank you all guys you've been very helpful!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.bashrc ? Longinus Linux - Newbie 2 03-27-2004 11:50 AM
no .bashrc? mattman Slackware 6 06-10-2003 03:59 PM
.bashrc roofy Slackware 7 05-06-2003 01:32 PM
bashrc nobu Slackware 6 03-21-2003 10:53 AM
.bashrc prasad Linux - General 1 04-14-2001 09:51 AM


All times are GMT -5. The time now is 11:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration