LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 11-08-2004, 10:01 AM   #1
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-15.0
Posts: 833

Rep: Reputation: 90
No 'Fancy' prompt in console?


Hi all,

when i login to cli console, I get a weird prompt:
Quote:
;leon@leon-fyg: /home/leonleon@leon-fyg:~$
Roots prompt is fine though:
Quote:
leon-fyg: /home/leon#
Here is my ~/.bashrc
Code:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If running interactively, then:
if [ "$PS1" ]; then

    # don't put duplicate lines in the history. See bash(1) for more options
     export HISTCONTROL=ignoredups

    # check the window size after each command and, if necessary,
    # update the values of LINES and COLUMNS.
    #shopt -s checkwinsize

    # enable color support of ls and also add handy aliases
    if [ "$TERM" != "dumb" ]; then
        eval `dircolors -b`
        alias ls='ls --color=auto'
        #alias dir='ls --color=auto --format=vertical'
        #alias vdir='ls --color=auto --format=long'
    fi

    # some more ls aliases
    alias ll='ls -l'
    alias la='ls -A'
    alias l='ls -CF'

    # set a fancy prompt
#    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

    # If this is an xterm set the title to user@host:dir
    case $TERM in
    xterm*)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
        ;;
    *)
        ;;
    esac

    # enable programmable completion features (you don't need to enable
    # this, if it's already enabled in /etc/bash.bashrc).
    #if [ -f /etc/bash_completion ]; then
    #  . /etc/bash_completion
    #fi
fi
As you see, I commented out the fancy prompt option, however, it remains as described above.

In /etc/bash there is an identical option, but that one is also commented out:
Code:
----snap----
# set a fancy prompt (non-color)
#PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
----snap----
Any tips to get a _really_ fancy prompt, or to disable the distorted user one?

Btw, in graphical console, the prompts are just fine.

Cheers, Leon.
 
Old 11-08-2004, 10:11 AM   #2
michapma
Member
 
Registered: Oct 2003
Location: Zürich
Distribution: Debian
Posts: 537

Rep: Reputation: 39
Sorry to ask a dumb question, but I don't know what a cli console is. I suppose that if it's not related to bash, then .bashrc will have no effect. Don't forget to uncomment that line when you're done experimenting.

If I use those default options you showed in Gnome, I get a simple user@computer:dir$ prompt, with color. (I guess the color could be set by Gnome.
 
Old 11-08-2004, 10:20 AM   #3
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-15.0
Posts: 833

Original Poster
Rep: Reputation: 90
cli = command line interface, the text console rather than the graphical one.

~/.basrc takes care of stuff when logging into text console, whereas ~/.bash_profile is sourced after logging into graphical mode (e.g. gnome). ~/.bash_profile also reads the options in ~/.bashrc

PS: all this while running Debian.

Last edited by BroX; 11-08-2004 at 10:22 AM.
 
Old 11-08-2004, 10:36 AM   #4
michapma
Member
 
Registered: Oct 2003
Location: Zürich
Distribution: Debian
Posts: 537

Rep: Reputation: 39
Thanks!

Obviously I don't have the answer to your problem, but I did a forum search and at least I found a neat reference for you:
http://www-106.ibm.com/developerwork.../l-tip-prompt/

Cheers
 
Old 11-08-2004, 10:38 AM   #5
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517

Rep: Reputation: 58
Don't know if this is a SuSE speciality, but theres a bash.bashrc in /etc. Maybe there is an overlaying config on Debian, too.
 
Old 11-08-2004, 11:22 AM   #6
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-15.0
Posts: 833

Original Poster
Rep: Reputation: 90
Quote:
Originally posted by abisko00
Don't know if this is a SuSE speciality, but theres a bash.bashrc in /etc. Maybe there is an overlaying config on Debian, too.
Yeah there is, but also there the fancy prompt option is commented out. That's actually the file I mentioned in my first post. Where it reads
Quote:
In /etc/bash there is an identical option, but that one is also commented out:
it should have been
Quote:
In /etc/bash.bashrc there is an identical option, but that one is also commented out:
 
Old 11-08-2004, 11:37 AM   #7
garywk
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian (sarge)
Posts: 20

Rep: Reputation: 0
Your problem is where you made your changes. Making a change in .bashrc only changes settings for non-login shells. To make a change to your login shell you must make your change in .bash_profile.

If you don't believe this take a look at the top line of your system generated .bashrc file. It says:

Quote:
# ~/.bashrc: executed by bash(1) for non-login shells.
If I want to change a login shell setting I change .bash_profile. Notice the top line from the system generated .bash_profile.

Quote:
# ~/.bash_profile: executed by bash(1) for login shells.
 
Old 11-08-2004, 11:48 AM   #8
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517

Rep: Reputation: 58
LJSBrokken:

I am sorry, I did not read the post carefully.

But now (after careful reading), I recognised this:

Quote:
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
Doesn't this create this weird prompt? I am not a good programmer (if at all), but I recognised some similarities.

Last edited by abisko00; 11-08-2004 at 11:49 AM.
 
Old 11-08-2004, 12:05 PM   #9
garywk
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian (sarge)
Posts: 20

Rep: Reputation: 0
deleted post
 
Old 11-08-2004, 12:09 PM   #10
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517

Rep: Reputation: 58
^^???
 
Old 11-09-2004, 04:47 AM   #11
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-15.0
Posts: 833

Original Poster
Rep: Reputation: 90
garywk:

Thanks, but ~/.bash_profile should read the settings in ~/.bashrc anyway?
Quote:
leon@leon-fyg:~$ cat .bash_profile
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/sbin:/usr/bin:/usr/local/bin:/opt/kde/bin

export PATH
unset USERNAME
leon@leon-fyg:~$
And what is a non-login shell? As far as I know (which isn't far ) there's only one way for me to access linux and that is by logging in...
 
Old 11-09-2004, 07:26 AM   #12
garywk
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian (sarge)
Posts: 20

Rep: Reputation: 0
Quote:
Thanks, but ~/.bash_profile should read the settings in ~/.bashrc anyway?
Well, in my experience of changing the bash environment non-login shells aren't affected by .bash_profile. I wanted to allow specific users to have access to specific commands in the bash shell to which root only has access. I copied the commands to a hidden folder in their home folder and then I added that folder to the path in .bash_profile and nothing changed as my users log into the gui and don't use a login shell. I made the changes in .bashrc and, bingo, it worked.

It seems to me that .bash_profile is read at login not .bashrc, or if .bashrc is read the settings don't seem to be applied to login shells and .bash_profile settings are not applied to non-login shells.

My experience with it says that the comments at the top of each file are there for a purpose.
 
  


Reply



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
No login prompt on console after boot fiservguy Linux - General 5 01-13-2009 04:26 PM
Difference between Console, Shell, and Command Prompt Anupam Pathak Linux - Newbie 3 10-23-2005 04:40 AM
Cant get console prompt or su in KDE on compiled 2.6.8.1 martinp26 Linux - General 3 09-02-2004 10:04 AM
Bluecurve to console prompt roiboy Linux - Newbie 1 04-28-2004 01:19 PM
Console prompt woes ericcarlson Linux - Software 3 03-12-2003 03:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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

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