Find the answer to your Linux question:
Page 1 of 4 1 2 3 4 LastLast
Results 1 to 10 of 34
After loading and installing Gentoo 2.4.20r6 I get what seems like a generic command line.. I.E.... After a reboot and I log in as my local usr, KDE loads and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113

    Bash profile problem????'s


    After loading and installing Gentoo 2.4.20r6 I get what seems like a generic command line..

    I.E....

    After a reboot and I log in as my local usr, KDE loads and I open a shell.

    The shell always has the generic line of:

    bash-2.05b$

    No matter where I'm at in the directory Tree.
    If I "su" its the same thing but ofcourse the "$" is replaced with the "#" sign.

    This didn't really bother me at first until I noticed that I was always having to "pwd" to figure out which directory I was in.. Kindof annoying.
    Now if I:
    Code:
    source /etc/profile
    I get a nice colorful new prompt deadmeat jbanks # of which I was used to see'ing all the time before going to Gentoo distro. So now I have "machine name" + "current directory" for the shell command prompt.
    I'm not sure what I need to do, or where. I'm pretty sure that I need to make a change to the script thats read at bootup that sets up the users profile but I forgot which script, where, and what modifications need to be removed or changed to get "what I thought was normal", back to what I consider normal.
    JB

  2. #2
    Linux User
    Join Date
    Jun 2003
    Location
    Huntington Beach, CA
    Posts
    390
    What terminal are you using? When I use aterm, I have to tell it to use the login shell, which gives the user@machine name prompt. The command aterm -ls does this, but it might vary from terminal to terminal. There is probably a way to tell all terminals to use the login shell by default, but I don't know how.

  3. #3
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    SiezedPropaganda said:
    1>What terminal are you using? When I use aterm, I have to tell it to use the login shell, which gives the user@machine name prompt. The command aterm -ls does this, but it might vary from terminal to terminal.

    2>There is probably a way to tell all terminals to use the login shell by default, but I don't know how.
    My response:
    1>Uhhhh...huh..huh....ummmm. Not sure exactly what you mean but I'm using KDE's default desktop shell "Konsole".....Is this what your asking ?
    2>Hummm...I'm pretty sure that this is specified in a profile as I stated earlier. But, again, I'm unsure which profile to change, where, and exactly what I need to change in that profile once I figure out which one is being used when init boots everything up. I think if I knew which profile is read first durning initial bootup I would have a better handle at least on which profile to start messing around in.
    Thanks,
    JB

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I would add this to ~/.bashrc:
    Code:
    . /etc/profile
    if [ -r ~/.bash_profile ]; then
        . ~/.bash_profile
    fi

  6. #5
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    Dolda2000 said:

    I would add this to ~/.bashrc:

    Code:
    . /etc/profile
    if [ -r ~/.bash_profile ]; then
    * * . ~/.bash_profile
    fi
    My response:

    Can you tell me in understandable terms what the above code is doing step by step so I can learn from what your telling me to do.

    I'm not sure where exactly/specifically you want me to put this codee when I'm inside .bashrc?
    does your first line have a space between the "." and the first "/" ?

    This is what mine looks like right now.
    Code:
    # /etc/skel/.bashrc:
    # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bashrc,v 1.8 2003/02/28 15:45:35 azarah Exp $
    
    # This file is sourced by all *interactive* bash shells on startup.  This
    # file *should generate no output* or it will break the scp and rcp commands.
    
    # colors for ls, etc.
    eval `dircolors -b /etc/DIR_COLORS`
    alias d="ls --color"
    alias ls="ls --color=auto"
    alias ll="ls --color -l"
    
    # Change the window title of X terminals
    case $TERM in
            xterm*|rxvt|Eterm|eterm)
                    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                    ;;
            screen)
                    PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                    ;;
    esac
    
    ##uncomment the following to activate bash-completion:
    #[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion

    Thanks Dolda2000
    JB

  7. #6
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    The

    . /etc/profile means that you are "sourcing" /etc/profile:s variables and configuration into you current shelll, that means that everything that is configured in /etc/profile will be submitted in your shell.

    Code:
     /etc/profile
    if [ -r ~/.bash_profile ]; then
        . ~/.bash_profile
    fi
    Means that if you have a readble (-r) file called .bash_profile in you home directory it also will be sourced in tho you current shell.

    This is a good setup because you then know that all basic configuration in /etc/profile that every user should have you will get and also your own configuration in your own .bash_profile. Textbook example...
    Regards

    Andutt

  8. #7
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    Thanks for the reply Andutt, this helps,

    But I still have 2 questions still unanwsered from my previous posting:

    1st question:

    I'm not sure where exactly/specifically you want me to put this code when I'm inside .bashrc or when I'm inside any config file for that matter? Is there a general rule of thumb where to stick edits to a config file if you adding simple things like were wanting to do in this example?


    2nd question:

    Does your first line have a space between the "." and the first "/" ?




    This is what my .bashrc looks like right now.

    Code:
    # /etc/skel/.bashrc: 
    # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bashrc,v 1.8 2003/02/28 15:45:35 azarah Exp $ 
     
    # This file is sourced by all *interactive* bash shells on startup.* This 
    # file *should generate no output* or it will break the scp and rcp commands. 
     
    # colors for ls, etc. 
    eval `dircolors -b /etc/DIR_COLORS` 
    alias d="ls --color" 
    alias ls="ls --color=auto" 
    alias ll="ls --color -l" 
     
    # Change the window title of X terminals 
    case $TERM in 
    * * * * xterm*|rxvt|Eterm|eterm) 
    * * * * * * * * PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' 
    * * * * * * * * ;; 
    * * * * screen) 
    * * * * * * * * PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' 
    * * * * * * * * ;; 
    esac 
     
    ##uncomment the following to activate bash-completion: 
    #[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
    JB

  9. #8
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'd put it in the beginning, so that you can override settings later in the file. And yes, there is a space between the dot and the slash on the first line. "." is an alias for "source".
    A small tip: if I'm ever unsure whether there is a space anywhere or not, I just select the text with the mouse to see where the character boundaries are.

    The reason why you have to put this in ~/.bashrc is because ~/.bashrc is executed when a non-login shell (such as those in an xterm) is started. When a login shell (such as those started by login) is started, /etc/profile and ~/.bash_profile are sourced automatically, while when a non-login shell is started, only ~/.bashrc is sourced. Therefore, if you add that to ~/.bashrc, /etc/profile and ~/.bash_profile is sourced whether or not it is a login shell.

  10. #9
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    Thanks Dolda,

    Perfect explantion for the level that I'm at. :P

    Coming from M$ and switching to Mandrake and then moving to Gentoo distro has proven to be quit interesting. MDK was my first linux experience and fiddled with it for about 6 months on and off then decided to goto Gentoo because of the RPM madness that I kept going through with MDK.

    M$ did everything for you and didn't give you many choices if you wanted to customize the O/S to your needs in most respects. Mandrake appearded to work out of the box and set everthing up for me and at the same time let me tailor my kernel if wanted and everything else, unlike M$. Gentoo on the other hand has made me tell it everything that I want it to do just about. So this has proven to be a very good learning experience for me.

    And as always you and the rest of the moderators on this site have helped make learning linux allot of fun.

    I didn't realize that there was "login" versus "non-login". And if my understanding is correct now...if I were to reboot in MDK it would automatically bring me to my desktop. So I'm assuminng that this was an example of a "login" shell being executed?

    With Gentoo, at least the way that its setup now.....when I reboot I'm prompted for the User/Password before being brought to the KDE desktop. Is this an example of a "non-login" shell being executed when I reboot?

    How difficult is it to setup Gentoo to automatically log me in each time or change my environment to use "login" versus "non-login"?

    If this is to big a task to explain then please just let me know where this is explained and I'll read for myself. This list has to spend enough time reading my posts let alone spend time writing detailed responses..

    Thanks,
    JB

  11. #10
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Actually, login shells are pretty rare these days, since most people log in to an X desktop environment and start shells from there. You mainly get login shells if you log in to a real text mode device, such as a text mode terminal or over ssh. The difference isn't really big, it's mainly a matter of which files that are sourced at startup. A common usage is to put a call to fortune in /etc/profile or some other message of the day stuff.

    When you log in to X, you usually don't get a shell at all, so that's not the same as getting a login shell.

    If you want to read up on it a bit, check the beginning of bash's manpage. To be complete, there are login shells, interactive shells (or non-login shells as I have been referring to them) and non-interactive shells. It's all the same shell, only that it applies some different behaviours to itself.

Page 1 of 4 1 2 3 4 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •