Just in case...
Here's what your
/etc/profile.d/lang.sh file should looks like:
Code:
cat /etc/profile.d/lang.sh
#!/bin/sh
# Set the system locale. (no, we don't have a menu for this ;-)
# For a list of locales which are supported by this machine, type:
# locale -a
# en_US is the Slackware default locale:
#export LANG=en_US
# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968. These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
#export LANG=C
# There is also support for UTF-8 locales, but be aware that
# some programs are not yet able to handle UTF-8 and will fail to
# run properly. In those cases, you can set LANG=C before
# starting them. Still, I'd avoid UTF unless you actually need it.
export LANG=en_US.UTF-8
# Another option for en_US:
#export LANG=en_US.ISO8859-1
# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
# change in many places. Since this isn't usually expected and
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
export LC_COLLATE=C
# End of /etc/profile.d/lang.sh
You would replace the "en_US" with "de_DE" for German, which is
Code:
locale: de_DE directory: /usr/lib64/locale/de_DE
-------------------------------------------------------------------------------
title | German locale for Germany
source | Free Software Foundation, Inc.
address | http://www.gnu.org/software/libc/
email | bug-glibc-locales@gnu.org
language | German
territory | Germany
revision | 1.0
date | 2000-06-24
codeset | ISO-8859-1
(you get this with
locale -av | pg or more).
You should not have edited
/etc/profile; at the bottom of the file you'll find
Code:
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script
which is used to execute what's found in
/etc/profile.d -- if you've added anything in
/etc/profile, probably a good idea to remove it.
Look around in
/etc/profile.d, particularly if you have edited any file in there and made additions (also check
/etc/profile for any additions you may have made).
One way to do "special" things in
/etc/profile.d is what I do because I do not use BASH on any of my systems. I use KornShell and I place an executable file in
/etc/profile.d to set environment variables when a user logs in:
Code:
cat ksh.sh
#!/bin/sh
#ident "$Id$"
#
# Name: $Source$
# Version: $Revision$
# Modified: $Date$
# Purpose: set local environment variables for Korn Shell
# Author: T. N. Ronayne
# Date: 1 Oct 2009
# $Log$
# Set the HOST environment variable
export HOST="`uname -n`"
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
# VISUAL=emacs # ugh
# VISUAL=gmacs # double ugh
VISUAL=vi # ah, elegence
fi
# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
# Do these anyway in case sombody uses a different shell
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='${HOST}-${USER}-${PWD}: '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
PS1='\u@\h:\w\$ '
fi
PS2='> '
export PS1 PS2
This file is taken from
/etc/profile and modified (the visual editing mode and the ksh prompt). Because the content of
/etc/profile.d is executed
after /etc/profile is executed, the setting in this file
replace the settings in
/etc/profile. Works for me.
The only place you would ever execute the
locale utility is in
/etc/profile.d/lang.sh; i.e., never in a user
.basrc or
.profile or any other file.
Also, setting the PATH environment would be done like this:
Code:
# change the PATH a little
export PATH=.:${HOME}/bin:${PATH}
That is done in my home directory
.profile file to place the
bin directory in my home directory prior to the system PATH (the colons are mandatory there to separate PATH environment settings). I am aware than doing this is questionable practice (having my own
bin directory preceding the system PATH) but I am always aware that my search path is set this way and I do a lot of programming that gets tested and debugged in my home directory so I'm good. I don't necessarily recommend this, it's just to show how to modify the PATH.
Looking at your first post, it looks like there's an edit somewhere in
/etc (maybe in
profile, maybe in
/etc/profile.d that is causing problems and you may want to extract the default
/etc/profile file from the distribution source (complicated) or simply replace your
/etc/profile with this one (which is unedited):
Code:
cat /etc/profile
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.
# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
export INPUTRC=/etc/inputrc
fi
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi
# I had problems with the backspace key using 'eval tset' instead of 'TERM=',
# but you might want to try it anyway instead of the section below it. I
# think with the right /etc/termcap it would work.
# eval `tset -sQ "$TERM"`
# Set TERM to linux for unknown type or unset variable:
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
TERM=linux
fi
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
VISUAL=emacs
# VISUAL=gmacs
# VISUAL=vi
fi
# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
PS1='$ '
else
PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2
# Default umask. A umask of 022 prevents new files from being created group
# and world writable.
umask 022
# Notify user of incoming mail. This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
biff y 2> /dev/null
fi
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script
It's a Good Idea to never edit
/etc/profile but to place a
.profile in your home directory to alter environment settings (as the example above).
When you log in,
/etc/profile is executed (it executes the content of
/etc/profile.d) then your
.profile file is executed if it exists. This is true for BASH, KornShell or just Bourne Shell if you choose to use that. If you're using BASH, a
.bashrc is executed last. That's the chain and somewhere you've got something goofy that's causing problems; you can compare the files above with yours to hopefully find what's different (or simply use them as a starting point).
Bear in mind that the "profile chain" is only executed when you log in -- if you make any changes, you will need to log out and log back in for them to take effect.
Hope this helps some.