Konsole in English

James Tyrer jrtyrer at earthlink.net
Wed Oct 28 02:03:51 GMT 2009


Ryo Furue wrote:
> Hi James,
> 
> | You appear to have snipped out:
> | 
> | "Second, if you do so (either way), it will affect the whole KDE session
> | for that user."
> 
> I don't understand why so.  You can change your own .bash_profile and
> .bashrc  and you can have your own konsole.desktop in
> ~/.local/share/applications/ .  I thought we were talking about
> per-user settings.
> 
Yes. and KDE sessions are per user.  If using KDM and the GUI login, 
when you login, you start a KDE session for that user.  So, when you 
login, the ".bash_profile" will be executed and with most distros, this 
will first source the ".bashrc" file.
> | 
> | That is why it won't work (or might not work).
> 
> Sorry I don't understand what "it" is.  What is not working?
> 
What Doton wants to do.  Have a different language setting for 
interactive BASH session -- use English in Konsole, while having his 
default language in the rest of the session.

> | If you read the 'Fine Man Page',
> | 
> | "When bash is invoked as an interactive login shell, or as a
> | non-interactive 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."
> | 
> | "When an interactive shell that is not a login shell is started, bash
> | reads and executes commands from ~/.bashrc, if that file exists."
> | 
> | You would think that it should work.  However, it is also common
> | practice for ".bash_profile" to change that.
> 
> Again, I'm afraid I fail to see what's the problem here.
> What does "it" refer to in your "You would think that it should work"?
> 
There is no problem there.  As I said, it appears that it should work, 
however, as I said, ".bash_profile" will also source ".bashrc".

> I know all those things you have quoted from the manual.
> 
But, responses to the list are written for everyone.

> | # .bash_profile
> | 
> | # Get the aliases and functions
> | if [ -f ~/.bashrc ]; then
> | 	. ~/.bashrc
> | fi
> 
> My ~/.bash_profile does have that clause.
> 
> So, in our situation, we want
> 
>    <OUR GOAL>
>    .bashrc        --- LANG=C
>    .bash_profile  --- LANG=your_native_language
> 
> Correct?
> 
> Then, our ~/.bashrc would read
> 
>    LANG=C; export LANG
> 
> and our ~/.bash_profile would read
> 
>    if [ -f ~/.bashrc ]; then
>  	. ~/.bashrc
>    fi
> 
>    # override what's in .bashrc
>    LANG=your_native_language; export LANG
> 
> Then, OUR GOAL is achieved.  Or am I missing something? 
> 
This is a kludge, but it would probably work.  What you are missing is 
that you are now setting the default language on a user basis rather 
than a global basis.  So, I do not see it as a good solution.  If you 
then change your LANG setting in the place where your distro put it, it 
doesn't work.

> By the way, I've found that most login managers don't source
> .bash_profile .  In that case, you have to use your desktop's
> (KDE's) autostart feature to load it.  For fortunately,
> KDM (KDE's login manager) reads your .bash_profile, at least
> on the distro I use (Debian GUN/Linux).
> 
They might not do this as the default due to the need for compatibility 
with various different shells.  IMHO, they should be configured to do 
this and therefore, I insisted that KDM do this.  However, if you know 
that the system uses BASH, there is a block of code at the start of 
KDM's "Xsession" script can be eliminate if the first line is changed to:

	#! /bin/bash --login

and you can do this to other *DM's "Xsession" scripts.

NOTE: you can't just add the "--login" to "/bin/sh" because then it 
would try to read the ".profile" file which probably doesn't exist on a 
Linux system and it is necessary for such a script to have (slightly) 
different syntax.

> | Fedora 10 "/etc/skel/.bash_profile" (the default):
> | 
> | ------8<------8<------8<------8<------8<------8<------8<------8<------
> | 
> | # .bash_profile
> | 
> | # Get the aliases and functions
> | if [ -f ~/.bashrc ]; then
> | 	. ~/.bashrc
> | fi
> | 
> | # User specific environment and startup programs
> | 
> | PATH=$PATH:$HOME/bin
> | 
> | export PATH
> | 
> | ------8<------8<------8<------8<------8<------8<------8<------8<------
> | 
> | It is this that would make it not work.  Now it is possible that your
> | distro doesn't have the code that sources ".bashrc" from
> | ".bash_profile", but I don't like to suggest that people should make
> | such changes to their distros.  The script will work for everyone, and
> | it is really the better way to do it since changing environment
> | variables in ".bashrc" can cause problems whether or not your distro
> | does this.
> 
> I'm not sure if I understand what you say correctly, but I don't see
> why you need a system wide change.  

You don't see that because I didn't say that.  My concern is that most 
users don't want to circumvent the way their distro does things.  It 
often leads to other problems.

> As the manual you quoted say,
> your ~/.bash_profile is read after the system wide .bash_profile
> is sourced.  So, you have only to make changes to your own 
> .bash_profile.
> 
> | it is really the better way to do it since changing environment
> | variables in ".bashrc" can cause problems whether or not your distro
> | does this.
> 
> "can cause problems"

Perhaps, 'might cause problems' would have been a better choice of words.

> --- What kind of problems do you have in mind?
> I've had "export LANG=C" in my ~/.bashrc for years, without having
> any problems at all.
> 
Then you haven't put anything in your ".bashrc" file that should only be 
put in your ".bash_profile".  Perhaps I should have made this clearer 
that there are some commands that tend to mess things up if run multiple 
times and, therefore, need to be in ".bash_profile".

	FOO="$FOO:bar"
	export FOO

really doesn't belong in ".bashrc".

-- 
James Tyrer

Linux (mostly) From Scratch
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list