LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-03-2012, 05:34 AM   #1
unodior
Member
 
Registered: Mar 2011
Distribution: Fedora 12
Posts: 56

Rep: Reputation: 28
I need the file bashrc for fedora 12


Hello again,

I'm using fedora 12 and ns-2.30 and I've accidentally changed the /etc/bashrc file instead of my own bashrc file. It gives me a strange message when I open the Konsole:
Code:
bash: /bin: es un directorio
The content of my /etc/bashrc file:
May it be related to this:
Code:
f ! shopt -q login_shell ; then # We're not a login shell
    # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
    pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
        fi
    }
I don't have the fedora 12 CD because I'm not working with my own laptop, but I know the root password. Could anyone upload a bashrc file or tell me where to get it (please, don't trick me, it's my work's PC) or better, print the content it should have ?

Thank you very much

Last edited by unodior; 05-03-2012 at 05:40 AM.
 
Old 05-03-2012, 09:36 AM   #2
uhelp
Member
 
Registered: Nov 2011
Location: Germany, Bavaria, Nueremberg area
Distribution: openSUSE, Debian, LFS
Posts: 205

Rep: Reputation: 43
/etc/bashrc
is a kind of "config file" for the bash.
It gives systemwide defaults.

And in your home dir there is another bashrc to handle user specific needs.

If you don't know, what to change, you can delete (i.e. rename) it and start bash.

To know why something is going wrong, you should let us know, what you've changed, and how bashrc looks like now.
 
1 members found this post helpful.
Old 05-03-2012, 11:26 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Everything found in the bash startup files is just a shell command, just like the ones you run directly. Whenever an interactive shell is started, the contents of the bashrc file are sourced (imported and executed) first, before turning control over to you. This allows you to customize your environment and run various commands automatically.

Nothing in it is required for the shell to run, although it may affect the things you do inside the shell. The default PATH to an executable or an environmental variable it depends on may not be set, for example.

Take the time to learn a little bit about shell scripting and the contents will not seem so cryptic to you.

Here are a few useful bash scripting references:
http://mywiki.wooledge.org/BashGuide
http://mywiki.wooledge.org/BashFAQ
http://mywiki.wooledge.org/BashPitfalls
http://www.linuxcommand.org/index.php
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/software/bash/manual/bashref.html
http://wiki.bash-hackers.org/start
http://ss64.com/bash/


The patch of code you posted, by the way, is just the definition of a function that checks your PATH variable for a given string, and adds the new value either to the front or end of it if not found. On its own it does nothing but set up the command. It has to be executed later on, either in the file or in the shell. As the comment to it also says, it's being set here because of a command in your /etc/profile file that unsets it.

( Actually, this is a bit strange. AFAIK, /etc/profile isn't loaded by default for non-login shells. Perhaps it's being sourced earlier on in the bashrc. See the bash manpage INVOCATION section for more on which files are used by default. )


If you want a quick fix, one thing you can do is first rename your bashrc away from it's original location. Then open the default shell and start executing the commands in the file one at a time. When you find the one(s) that give you errors, you know what needs fixing or removing. But again, it's better when you understand what you are doing, so I recommend starting with the links I gave above.
 
1 members found this post helpful.
Old 05-04-2012, 02:33 AM   #4
unodior
Member
 
Registered: Mar 2011
Distribution: Fedora 12
Posts: 56

Original Poster
Rep: Reputation: 28
Thanks to all of you.
Now it works, but it gives me a message when I open the Konsole. I'm going to upload my file so you can see the content. If you see something wrong please tell me. But this is the etc/.bashrc file, not my home/user/.bashrc file.
Anyway I'll read the links you've told me.

Last edited by unodior; 05-04-2012 at 02:50 AM.
 
Old 05-04-2012, 04:43 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Just out of curiosity, how were you able to accidentally edit a file that need root permissions to be altered when you wanted to edit a file in your home-directory? Are you logged in as root anytime?
 
  


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 file LinuxUser101 Linux - Newbie 4 04-14-2008 07:55 PM
Bashrc file Gins Linux - General 19 09-06-2005 03:19 PM
can't the file bashrc Paxmaster Linux - Software 10 01-02-2005 06:58 AM
where is the .bashrc file??? xenia Linux - Newbie 8 05-08-2004 12:11 PM
bashrc file Linvilidiot Linux - Newbie 3 03-11-2004 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:46 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration