LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-05-2021, 09:48 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Rep: Reputation: 179Reputation: 179
LS_OPTIONS not working on Slackware Current


I installed Slackware Current a couple of weeks ago -- am finding little tweaks that need to be addressed. For years I've added "--time-style=long-iso" to OPTIONS env variable in /etc/profile.d/coreutils-dircolors.sh to set my ls time style. This gets exported in LS_OPTIONS.

When I log in using Konsole, LS_OPTIONS is empty. Maybe this is normal and I just never noticed it before. I suppose that's possible as I usually ssh from there to other hosts.

If I su to myself (su - myid), LS_OPTIONS are set.

How to I get this to set when I simply open Konsole? Do I have to source /etc/profile.d/coreutils-dircolors.sh in .bashrc? That seems wrong, but it that's what I should do, I'll do it.
 
Old 03-05-2021, 11:06 PM   #2
kaott
Member
 
Registered: Mar 2020
Posts: 63

Rep: Reputation: Disabled
An easy check is to make sure that the /etc/profile.d/coreutils-dircolors.sh file is set to executable. The /etc/profile script checks /etc/profile.d for executable scripts and sources them if they are set to be executable.
 
Old 03-06-2021, 01:00 AM   #3
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by mfoley View Post
I installed Slackware Current a couple of weeks ago -- am finding little tweaks that need to be addressed. For years I've added "--time-style=long-iso" to OPTIONS env variable in /etc/profile.d/coreutils-dircolors.sh to set my ls time style. This gets exported in LS_OPTIONS.

When I log in using Konsole, LS_OPTIONS is empty. Maybe this is normal and I just never noticed it before.
This is what I have. This is what is set in /etc/profile.d/coreutils-dircolors.sh. This is the default.
Code:
echo $LS_OPTIONS
-F -b -T 0 --color=auto
 
Old 03-06-2021, 07:12 AM   #4
BrunoLafleur
Member
 
Registered: Apr 2020
Location: France
Distribution: Slackware
Posts: 405

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by mfoley View Post
I installed Slackware Current a couple of weeks ago -- am finding little tweaks that need to be addressed. For years I've added "--time-style=long-iso" to OPTIONS env variable in /etc/profile.d/coreutils-dircolors.sh to set my ls time style. This gets exported in LS_OPTIONS.

When I log in using Konsole, LS_OPTIONS is empty. Maybe this is normal and I just never noticed it before. I suppose that's possible as I usually ssh from there to other hosts.

If I su to myself (su - myid), LS_OPTIONS are set.

How to I get this to set when I simply open Konsole? Do I have to source /etc/profile.d/coreutils-dircolors.sh in .bashrc? That seems wrong, but it that's what I should do, I'll do it.
In the profil menu and the main tab, what command do you have : I have '/bin/tcsh -l'. You can have '/bin/bash -l'

'-l' is for login shell. Else it won't call '/etc/profile.d'
 
Old 03-06-2021, 08:08 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,916

Rep: Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033
Personally I think running a 'login shell' inside of a terminal emulator is a mistake. Better to put your aliases, PS settings, and what have you in ~/.bashrc.

Then, if you want to tie profile and bashrc together, so that your customisations are also available to login-shells, then just add this to the end of /etc/profile, or your user's ~/.bash_profile
Code:
# If interactive bash shell then source ~/.bashrc:
case "$-" in
  *i*)  [ "x$BASH" != 'x' ] && [ -f ~/.bashrc ] && . ~/.bashrc ;;
esac
 
1 members found this post helpful.
Old 03-06-2021, 08:47 AM   #6
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by chrisretusn View Post
This is what I have. This is what is set in /etc/profile.d/coreutils-dircolors.sh. This is the default.
Code:
echo $LS_OPTIONS
-F -b -T 0 --color=auto
As mentioned above by @BrunoLafleur I have this the "Command:" field for the Konsole default profile "/bin/bash -l"

I've been doing this for years. I see nothing wrong with it.

Last edited by chrisretusn; 03-06-2021 at 08:48 AM.
 
Old 03-06-2021, 10:07 AM   #7
Paulo2
Member
 
Registered: Aug 2012
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 934

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
I have /etc/profile.d/coreutils-dircolors.sh "sourced" in .bashrc,
then I edit LS_OPTIONS
export LS_OPTIONS="$(sed 's/-F//' <<<"$LS_OPTIONS")"
 
Old 03-06-2021, 10:24 AM   #8
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,916

Rep: Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033
Quote:
Originally Posted by chrisretusn View Post
As mentioned above by @BrunoLafleur I have this the "Command:" field for the Konsole default profile "/bin/bash -l"

I've been doing this for years. I see nothing wrong with it.
Depends what's in your /etc/profile.

Simple example:

/etc/profile resets PATH, so any additional directories that might be in the $PATH of your X11 environment may be removed if you start a terminal window with a login shell. I guess it all boils down to whether you want that behaviour or not, and whether you see the terminal window as conceptually part of your X11 environment, or a standalone tty.
 
Old 03-06-2021, 01:14 PM   #9
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by chrisretusn View Post
As mentioned above by @BrunoLafleur I have this the "Command:" field for the Konsole default profile "/bin/bash -l"

I've been doing this for years. I see nothing wrong with it.
Thanks all for your feedback. chrisretusn - that did the trick! Adding -l to the Command; field of the profile invoked coreutils-direcolors.sh and set the LS_OPTIONS as I configured. Thanks. I don't think I'd have ever figured that out!
 
Old 03-06-2021, 08:48 PM   #10
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by GazL View Post
Depends what's in your /etc/profile.

Simple example:

/etc/profile resets PATH, so any additional directories that might be in the $PATH of your X11 environment may be removed if you start a terminal window with a login shell. I guess it all boils down to whether you want that behaviour or not, and whether you see the terminal window as conceptually part of your X11 environment, or a standalone tty.
Thanks for the explanation. I don't change things in /etc/profile. The only things I setup are aliases. I do that with .profile in the user home directory.
 
Old 03-07-2021, 06:01 PM   #11
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by GazL View Post
Personally I think running a 'login shell' inside of a terminal emulator is a mistake. Better to put your aliases, PS settings, and what have you in ~/.bashrc.
I'd be interested in hearing your reasons for this. I've long not understood why someone would want to have a different environments when using a login vs non-login shell. For me, I just make EVERYTHING a login shell to make sure I know that my environment will be the same no matter how I access the shell.

In response to your post later on:

Quote:
/etc/profile resets PATH, so any additional directories that might be in the $PATH of your X11 environment may be removed if you start a terminal window with a login shell.
Is this a real thing? I've never noticed WMs/DEs add additional directories to the PATH variable. I checked this on my 14.2 install running KDE4 by launching xterm (I normally use konsole with a login shell), echo'd $PATH, then ran bash -l and echo'd $PATH again and they were the same. I don't have a .profile or .bashrc. I could tell they were non-login and login shells respectively since my PS1 changed when I ran bash -l.

NOTE: This isn't to call you out or anything, but to try and improve my knowledge on the subject. I've read things throughout the years on the subject, but nothings seemed to stick on why I should use non-login shells over login shells.
 
Old 03-07-2021, 07:35 PM   #12
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,916

Rep: Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033Reputation: 5033
Quote:
Originally Posted by bassmadrigal View Post
I'd be interested in hearing your reasons for this.
Yes, no worries.

For the PATH example, I'm not aware of anything that does this out of the box, it was just an obvious example of why it could potentially be an issue. As an actual example of why one might want to do something like that, one might not want all the X11/GUI programs in the PATH of a tty shell that isn't even able to run them (well not without setting DISPLAY to point to a remote X11 server anyway), so having them in a separate directory that only gets added to the PATH of an X11 session would make sense. In fact, didn't we used to have something like a /usr/X11R6/bin in the old days for exactly this reason?

On the more general topic, clearly the designers of the UNIX shell decided that it was important to differentiate between login and non-login shells and that some programs might need to only be started for login shells: things like gpg-agent spring to mind, where one might want gpg-agent starting in /etc/profile of a tty console login shell, but that an X11 equivalent would be started by xinitrc/xsession and so it would be inappropriate to have another instance started in each and every terminal emulator shell.

It's also worth mentioning that unless run as /bin/sh, bash doesn't follow the traditional shells invocation methods: using /etc/profile and $ENV. Putting a call to bashrc at the end of /etc/profile goes some way to making bash work something akin to the more traditional invocation model, though not exactly the same.

As I said in my original post here, I still think it's a mistake to run a terminal shell as a login shell, but in practice, these days, I doubt it will make any practical difference to most people, and I'm probably just being a purist.

I suspect much of the reasons why these things are done the way they are have been lost to time, except for a few old farts like me who still remember and cling to the old ways.

Hope that made at least some sense.
 
1 members found this post helpful.
Old 03-07-2021, 11:40 PM   #13
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
I appreciate the response. It's always interesting to read peoples' reasonings when they do something different than I do. I can definitely see examples like gpg-agent being a valid reason to separate login vs non-login shells.

Quote:
Originally Posted by GazL View Post
As I said in my original post here, I still think it's a mistake to run a terminal shell as a login shell, but in practice, these days, I doubt it will make any practical difference to most people, and I'm probably just being a purist.
I think this is ultimately the conclusion I come up with when I do research this. There's probably good reasons it was designed this way, but most software probably doesn't take those into account anymore. If I run into an issue using login shells everywhere, then I'll likely decide to switch to using both, but I just haven't noticed any issues in my particular usage.

Again, I really appreciate the response! I definitely learned some stuff with it.
 
Old 03-08-2021, 12:20 PM   #14
BrunoLafleur
Member
 
Registered: Apr 2020
Location: France
Distribution: Slackware
Posts: 405

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Personally, I use always login shells in a terminal, with some exceptions of dedicated terminals lauched by an application.

Also scripts are non login shells as they need less generic initialisation.

But everyone is free to have his strategy.

I do like that since maybe 30 years or more.
 
  


Reply

Tags
konsole, slackware



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
USB DAC not working properly in 14.2/-current, but working fine in Slackware Live dimm0k Slackware 6 03-06-2020 01:50 AM
Network Manager not working in 14.2/current, Wicd works in 14.2 but not -current? linus72 Slackware 6 04-30-2019 03:04 AM
[SOLVED] setting LS_OPTIONS? dchmelik Slackware 4 10-05-2017 11:51 AM
The LS_OPTIONS variable. stf92 Slackware 6 06-01-2013 01:34 PM
[SOLVED] Changing LS_OPTIONS alias in Opensuse 11.4 corp769 SUSE / openSUSE 2 10-06-2011 05:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:03 AM.

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
Open Source Consulting | Domain Registration