aliases set by /etc/profile not working in terminals in X
SlackwareThis Forum is for the discussion of Slackware 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.
aliases set by /etc/profile not working in terminals in X
This kinda goes back to a problem I had in another thread, wanting to see the colored filenames/directories in the terminal. I set up global aliases, a custom shell prompt, and the colors and all that through a script called /etc/profile.d/alias.sh, and have it running along with the other *.sh scripts in /etc/profile.d due to the following code in /etc/profile.
Code:
for file in /etc/profile.d/*.sh ; do
if [ -x $file ]; then
. $file
fi
done
Now, this works, UNTIL I run startx and enter my WM. Then no matter what terminal I try, none of them show the colors or the custom shell prompt, and none of the aliases work. Then if I exit my WM and am back at the console, they work again.
The prompt for my terminals in X is bash-2.05b$. That is NOT what it was when I first logged in (even prior to changing the entry in /etc/profile). So some other script must be overriding what /etc/profile is setting.
Yeah, I have done that for aliases that I want for just my user, but these I want to be default for ALL users, hence they are in the global profile file, /etc/profile.
You could just symlink every other users ~/.bashrc to one .bashrc, and then you would only have to change one. That might work, if you know that using .bashrc works in a terminal.
If you say that the /etc/profile works when you are not in X, but not when you are opening a terminal in X, then I assume that you may not have setup your terminal to be a login terminal.
For example, If you are using kconsole as your terminal, you will have to go to settings in KDE, and set kconsole to be a login terminal, so that the /etc/profile will be read.
I believe the same can be the case for other terminal apps. such as eterm, gnome-session, rxvt, xterm, etc.
Yeah, I actually just figured out the problem about an hour ago. Since my terminal is not a login shell, the terminals were looking for /etc/bashrc and ~/.bashrc for initialization. So, I just created an /etc/bashrc, and wrote a small script to see if the shell was a login shell, and if not to execute the bash scripts in /etc/profile.d. And so far so good, and all is well as long as the ~/.bashrc checks for the existence of /etc/bashrc and executes it if it exists (I added a couple lines to every user's ~/.bashrc to do so, and also added this to the default .bashrc in /etc/skel.
i have konsole on my KDE taskbar but it does not appear in settings / control centre menu .could yo please say exactly where in KDE/settings to set konsole to a login shell so that it behaves identically to the login shell at boot time ..
There is nothing configured on the pc ,its out of the box default slackware 9
ie no bashrc or bash.profile or anything else,.. just /etc/profile.
Originally posted by newlin i have konsole on my KDE taskbar but it does not appear in settings / control centre menu .could yo please say exactly where in KDE/settings to set konsole to a login shell so that it behaves identically to the login shell at boot time ..
There is nothing configured on the pc ,its out of the box default slackware 9
ie no bashrc or bash.profile or anything else,.. just /etc/profile.
thanks
If I recall, you can open up a kconsole window, and access its preferences from its own menu. The menu that pops up, is the same as the one you would find if you searched for it under the KDE system configuration app. Once you are in the preferences for kconsole, you should be able to find that setting to make kconsole a login shell.
Sorry if I am not too detailed, but I don't use KDE, I only remember from what I played with when KDE 3.0 came out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.