DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
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:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.