LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-23-2003, 08:09 PM   #1
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Rep: Reputation: 0
Setting LC_CTYPE in XTerm under MDK/WM


Currently I run mdk9.1 and windowmaker 0.8. In windowmaker I run an XTerm.
First I had problems with my man pages in this XTerm: All "-" was replaced by weird stuff. I found a solution: export LC_CTYPE=C.

My problem is to load this at startup!

I tried to put it in my ~/.bashrc
With this setting LC_CTYPE is set right in console (ie not under X),
but in my XTerm (under X) I have:
$ echo $LC_CTYPE
da_DK.UTF-8

Where should this command be placed?
(~/.bash_profile doesn't work)

Thx in advance
 
Old 11-23-2003, 09:27 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Depends on whether the xterms in wm are
login shells or not. You could try to symlink
(ln -s ~/.bashrc ~/.bash_login)


Cheers,
Tink
 
Old 11-24-2003, 01:32 PM   #3
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
Nope, that doesnt work. Not a login shell.
 
Old 11-24-2003, 02:43 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
is ~/.bashrc executable?

Cheers,
Tink
 
Old 11-24-2003, 03:48 PM   #5
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
No it wasn't. (Should it be?) Anyway I tried to make it exec. and it didn't work :-(

Could it be, that my XTerm is started with an argument setting the locale (LC_CTYPE)?
Where can I find out?
What starts the XTerm?

Thanx!
 
Old 11-24-2003, 03:56 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by martint
]No it wasn't. (Should it be?) Anyway I tried to make it exec. and it didn't work :-(
Why/how did it not work?
What's the error message?

Quote:
Could it be, that my XTerm is started with an argument setting the locale (LC_CTYPE)?
Where can I find out?
What starts the XTerm?

Thanx!
How do you start it? :)

have a look at ~
ls ls -Ald .*
Maybe there's another .bash-file (.bash_profile)
or .profile that messes with you?



Cheers,
Tink
 
Old 11-24-2003, 04:52 PM   #7
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
My .bash_profile is just:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export PATH=$PATH:$HOME/bin
unset USERNAME

My .bashrc reads:
# .bashrc
# User specific aliases and functions
[snip]
# This locale setting should fix the "-" and "--" in man pages.
# Works in console, but is overwritten somewhere else in WM.
export LC_CTYPE=C
echo "LC_CTYPE="$LC_CTYPE
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

I tried to place "export LC_CTYPE=C" in .bash_profile too, but that doesnt work.

How do i run my XTerm:
I use WM so I can run both XTerm and rxvt from the menu. They run:
xterm -sb
rxvt -bg black -fg white -fn fixed
(I then start them automatically from the dock.)
Both XTerm and rxvt has LC_CTYPE=da_DK.UTF-8
 
Old 11-24-2003, 05:03 PM   #8
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
I found out that if I run
bash --login
in my XTerm, it sets LC_CTYPE=C. Can this be any help? My /etc/bashrc is:

# /etc/bashrc
echo "Loading /etc/bashrc"

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
umask 002
else
umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if [ -z "$loginsh" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -x $i ]; then
. $i
fi
done
fi
fi

unset loginsh
 
Old 11-24-2003, 05:20 PM   #9
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
# /etc/profile.d/lang.sh - set i18n stuff
sourced=0
if [ -n "$GDM_LANG" ]; then
sourced=1
LANG="$GDM_LANG"
else
# only source one of the possible files, and in that order;
# if system wide and user config are mixed and different, umpredictable
# things will happen...
for langfile in $HOME/.i18n /etc/sysconfig/i18n ; do
[ -f $langfile -a "$sourced" = "0" ] && . $langfile && sourced=1
done
fi
if [ "$sourced" = 1 ]; then
if [ -n "$LANG" ] ; then
[ "$LANG" = "C" ] && LANG="en_US"
export LANG
else
unset LANG
fi
[ -n "$LANG" ] && export LANG || unset LANG
[ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
###################################################
[snip]

How does this affect LC_CTYPE in a non-login shell?
 
Old 11-24-2003, 05:25 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Good question ... not sure how stuff is
dealt with in wm, but could the shells
inherit from the wm process which
most likely will be a login-shell? :)


Cheers,
Tink
 
Old 11-24-2003, 05:55 PM   #11
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
Talking Problem Solved!!!

I'm happy to anounce that the problem is solved. I found that:
~/.bashrc calls etc/profile.d/lang.sh, which in turn modifies LC_CTYPE (in some way i dont understand (yet)). So placing

export LC_CTYPE=C

ABOVE

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

makes my manual pages happy :-)

Many thanks to you, Tinkster, for being so patient with me.
 
Old 03-08-2004, 04:11 PM   #12
arkanoize
LQ Newbie
 
Registered: Aug 2003
Posts: 1

Rep: Reputation: 0
Another way: to set or remove 'LC_CTYPE=' to the desired value in /etc/environmet.

I

Last edited by arkanoize; 03-08-2004 at 07:59 PM.
 
  


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
how is black xterm background in IceWM when issue a xterm command? BRAHmS Linux - Software 1 02-14-2005 04:51 AM
Setting up Imap folders in MDK 10.1 Toadman Linux - Newbie 0 12-28-2004 08:34 PM
Setting Security Policies in MDK? unixfreak Linux - Security 1 09-01-2004 09:32 PM
Setting up MDK 9.2 Firewall raysr Linux - Newbie 13 01-05-2004 08:46 PM
setting the PS1 enviroment variable in xterm schatoor Linux - General 2 04-29-2003 09:41 AM


All times are GMT -5. The time now is 12:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration